Remote Host Identification Error


Symptom(s): Can’t access the server via SSH and this message shows:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is

 

xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.

 

Please contact your system administrator.
Add correct host key in /path/to/users/.ssh/known_hosts to get rid of this message.
Offending RSA key in /path/to/users/.ssh/known_hosts:<line_number>
RSA host key for has changed and you have requested strict checking.
Host key verification failed.

 

Resolutions: Invalid key present at line <line_number>. This can also be caused when you transfer a host or recently formatted a server and it is not authenticating the RSA key. To fix this, we need to delete the old value of the host key.

Method 1: USING TERMINAL METHOD 

Enter this command into ssh command and press enter (remember to replace <IP_ADDRESS> with your server IP)

ssh-keygen -R <IP_ADDRESS>

Method 2: MANUAL METHOD ON MAC

1. First go to your mac menu at the top and click on “Go”

2. Click on “Go to the folder” (or hold down Shift+G+Command key)

Clear Known Hosts 1

3. Type in the /path/to/your_username/.ssh and click on “Go”, for example:

Clear Known Hosts 2

4. Locate the file called “known_hosts”

– Either open it in a text editor, then delete the RSA value at <line_number> OR:
– Simply delete the file “known_hosts”

Clear Known Hosts 3

5. You can re-log into your SSH fine now! The server will generate a new RSA key and save it to your computer in the file “known_hosts”