Disable SSH Known Host Checking

We’ve all ran into this annoying message when using ssh to connect to more than one computer behind the same IP address.

Offending key in /root/.ssh/known_hosts

And we all know that deleting the offending line in that file will solve our problems, but doing it every time is such a hassle, and if you need to do this on a constant basis, you really can’t be doing this every time. Well, a quick change to your SSH’s configuration file will do the trick!

Open the file /etc/ssh/ssh_config in your favorite text editor, and add the following two lines below Host * in the configuration file.

StrictHostKeyChecking no
UserKnownHostsFile /dev/null

This will disable strict host checking, and automatically write the known hosts to a black hole. You will never be disturbed by that prompt again!

NOTE: If your network security isn’t extrapolated from this process somehow, you probably don’t want to disable this check.

Leave a Reply