ssh连接云服务器Host key verification failed

一、用ssh连接远程服务器意外报错。

报错信息

$ ssh root@123.56.*.*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ECDSA key sent by the remote host is
SHA256:bXx9swgY6Th3F0kzBkUEwfU7euCoNjtpzMznyqPUb40.
Please contact your system administrator.
Add correct host key in /c/Users/87805/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/87805/.ssh/known_hosts:5
ECDSA host key for 123.56.*.* has changed and you have requested strict checking.
Host key verification failed.

二、报错原因

由于服务器重装系统、初始化磁盘等导致本地主机的SSH信息失效,即本地主机和远程服务器的SSH不匹配。

三、解决方案

在本地主机删除服务器的ssh密钥信息。在本地执行以下命令,删除本地主机中关于远程服务器的缓存和公钥信息。

ssh-keygen -R 服务器公网IP
posted @ 2020-03-30 11:02  langkye  阅读(347)  评论(0编辑  收藏  举报