SSH Remote host identification has changed
30 Sep 2017So you have recently connected to a remote Server A via ssh.
The Server A’s key is then saved into a file in your local PC, typically $HOME/.ssh/known_hosts
It may looks like this :
serverA ecdsa-sha2-nistp256 AAAAE2VjZHNhLXasdasdasdmlzdHAyNTYAAAAIbm
lzddddHAyNTYAAABBBNrIVAhYMcnUasdasdsdoMv7gtf8nMHghgYzVcdddkzbDM79C
81qswhYdd8L9VX+pNjg+asdasdasdasdasdasdxgooCk=
Imagine, suddenly, the remote Server A changed their key.
<pre>As a result, the key you have in your local PC, inside known_hosts becomes invalid.
The moment you try to ssh to Server A again, you will be prompted with :
<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, Monaco, Menlo, Courier, Verdana, sans-serif; font-size: 13px; margin-bottom: 26px; overflow: auto; padding: 13px; tab-size: 4; word-wrap: normal;">@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
a7:a8:f2:97:94:33:58:b7:9d:bc:e0:a6:6b:f7:0a:29.
Please contact your system administrator.
Add correct host key in /home/ramesh/.ssh/known_hosts to get rid of this message.
Offending key in /home/ramesh/.ssh/known_hosts: 6
Permission denied (publickey,password).</pre>The solution is to edit the file known_hosts and remove the existing key of Server A, </pre><pre>using your preferred text editor i.e. vi or vim or nano or notepad
When you try to ssh to Server A again, the new key of Server A will be saved into </pre><pre>your local file known_hosts.</pre>