Last Updated: February 25, 2016
·
2.161K
· darktim

Ignoring changed SSH hostkeys when connecting to a rescue mode

If you have booted one of your systems in a rescue mode, there may be changed ssh host keys preventing your ssh client to connect. If you are absolutely sure that it is OK to connect even if your ssh client is upset, the following alias may come handy:

alias nssh='ssh -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null'

In addition to do no strict hostkey checks, this also changes the known_hosts file to /dev/null in order to not polluting your keyfile.

This also works for scp:

alias nscp='scp -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null'

And if you are using rsync over ssh you may find that usefull, too:

alias nrsync='rsync -e "ssh -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null"'