Remove bad SSH key PDF Print E-mail
Written by JLangbridge   
Friday, 05 November 2010 10:19

It happens to all of us. We reinstall a PC, or change an IP address, and suddenly we can't connect to the machine via SSH. SSH is extremely secure, if the fingerprint of a machine changes, SSH refuses to connect, with a nice warning:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 

Do not take this warning lightly; it could be the result of a reinstall, but it could be that another host has taken the place of a previous host, which could be a BadThing(c). If you are absolutely sure that it is the same host (it happens to me when I reinstall), then there are ways of telling SSH that we can proceed. SSH stores the host fingerprints in a file, .ssh/known_hosts. You could just delete the file, but then every time to reconnect to another host for the first time, you get the authentication warning. The easiest way is to use ssh-keygen; ssh_keygen -R <host>. You can now reconnect to the host; SSH will ask to authenticate the host, and you will be up and running again.

 

 

Add comment


Security code
Refresh