Using SSH in scripts ignoring known_hosts file

Sometimes you want to automate some SSH command execution and don't really care about checking the remote machines in ~/.ssh/known_hosts. Warning: do this only if you really understand the consequences! I.e. it is very silly to ignore known_hosts on any machines across the Internet. It makes some sense on your intranet, where servers are rebuilt frequently and where external access is restricted; or where the user, executing the script, doesn't have write permissions for its own home directory, so no known_hosts file can be created. And even then think long and hard before using this trick:

  1. ssh -q -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"

It will, in effect, skip checking known_hosts altogether. Once again, BEWARE - do this at your own risk and don't even think about blaming me for any negative consequences! :)

Topic: 

1 Comment

Thanks

Thanks

Add new comment

Subscribe to Comments for "Using SSH in scripts ignoring known_hosts file"