2.11.1.1.3. REMOTE HOST IDENTIFICATION HAS CHANGED
When connecting to the server via SSH, you may encounter an error «WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!»... It usually looks like this:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. Please contact your system administrator. Add correct host key in /home/user/.ssh/known_hosts to get rid of this message. Offending RSA key in /home/user/.ssh/known_hosts:3 RSA host key for example.ftp.tools has changed and you have requested strict checking. Host key verification failed.
This error occurs due to a change in the server certificate. Before fixing the error, you should make sure that there is no third-party access to your network and no relaying is performed along the route to the target address, since this is how an MITM (Man In The Middle) attack is performed. Also, an error can occur when transferring a hosting account between our servers (for example, when migrations or for technical reasons). In this case, the error will most often be paired with an error. «WARNING: POSSIBLE DNS SPOOFING DETECTED!».
To fix it, you need to delete the existing key for the address. This can be done:
- By running the command:
ssh-keygen -R example.ftp.tools
Instead
example.ftp.tools
specify the address you are connecting to. - By removing the specifying key in the file
known_hosts
... Usually this file is located in/home/user/.ssh/known_hosts
on your device. In this file, the entries will look like this:Specifically, in this example, you need to remove all text from
example.ftp.tools
toxxxxxxx.ftp.tools
, that is: