Skip to content

Instantly share code, notes, and snippets.

@fukajun
Created October 9, 2012 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fukajun/3858147 to your computer and use it in GitHub Desktop.
Save fukajun/3858147 to your computer and use it in GitHub Desktop.
capistrano known hosts task
task :hoge do
temp_file = "/tmp/config.txt"
ssh_conf = "/root/.ssh/config"
run "echo 'Host *' > #{temp_file}"
run "echo 'StrictHostKeyChecking no' >> #{temp_file}"
run "echo 'UserKnownHostsFile /dev/null' >> #{temp_file}"
run "sudo mv #{temp_file} #{ssh_conf}"
run "sudo chmod 600 #{ssh_conf}"
run "sudo chown root:root #{ssh_conf}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment