So, you had a machine at a certain IP address or DNS name. You did something to that machine - for example, reinstalled the OS on it, or simply put a different computer on that IP. And now, from the Linux/Unix console, when using the SSH utility, you get the "RSA Host Key" error with the message "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!" and
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
blah-blah-blah.
Please contact your system administrator.
Add correct host key in /Users/<username>/.ssh/known_hosts to get rid of this message.
What this is hinting at is that the RSA key remembered earlier for this IP/hostname doesn't match what the server is now returning. In other words:
- Either someone has swapped out the machine in order to intercept (attack) your traffic;
- Or this machine simply changed its key (as in your case) - the key is generated uniquely for each machine and changes when the OS is reinstalled.
And unlike Windows utilities, it won't let you connect - there's no "OK, everything's fine" button here.
Let's fix it.
Go to your home directory (i.e., the directory of the user you're running SSH as) and switch to the .ssh subdirectory.
$ cd ~
$ cd .ssh
Here we find the known_hosts file and open it for editing. This file lists all the remembered keys tied to a hostname or IP address. Find the IP/hostname you need and simply delete that line.
That's it, no need to restart anything - it will start working right away, and on the next connection it will ask again whether to save the key.
Comments