SSH WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

My cloud server moved to VPC from classic network just now, and connecting to it via SSH got following error

Connecting to upay...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
91:65:8c:eb:63:86:5f:f2:b0:e6:77:d2:81:71:ef:2a.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:1
RSA host key for x.x.x.x has changed and you have requested strict checking.
Host key verification failed.
Couldn't read packet: Connection reset by peer

 

Solution

It seems the server host key is changed, one way to solve this prolem is to remove the line containing server IP address from

/root/.ssh/known_hosts

 . Then connect to it by SSH again, it will ask you whether trust this new host key, like following message

Connecting to upay...
The authenticity of host 'x.x.x.x (x.x.x.x)' can't be established.
RSA key fingerprint is 91:65:8c:eb:63:86:5f:f2:b0:e6:77:d2:81:71:ef:2a.
Are you sure you want to continue connecting (yes/no)?

Type yes and press Enter key, this new host key is added to

.ssh/known_hosts

  then.

 

Also you can obtain the host key from the remote server, and add it to

.ssh/known_hosts

  manually , but we won’t cover this method in detail.

The post SSH WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! appeared first on Redino blog.

Source: Redino