科技爱好者博客

解决ssh连接“Host key verification failed.”故障

ssh

在使用ssh连接服务器或者树莓派时,如果同一个IP的服务器重装或着重置过,则会出现Host key verification failed.故障,具体的错误信息如下:
~ % ssh pi@192.168.0.107
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:1gVpTczj+J2LqzcIINUPaOfrOEBmLwWKYeIN84cyof8.
Please contact your system administrator.
Add correct host key in /Users/liaixing/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/liaixing/.ssh/known_hosts:1
ECDSA host key for 192.168.0.107 has changed and you have requested strict checking.
Host key verification failed.
而解决这个故障非常简单,只需要“ssh-keygen -R 你要访问的IP地址”这个命令,即可获取最新的host key,故障得到解决。
liaixing@liaixingdeMacBook-Pro ~ % ssh-keygen -R 192.168.0.107
# Host 192.168.0.107 found: line 1
/Users/liaixing/.ssh/known_hosts updated.
Original contents retained as /Users/liaixing/.ssh/known_hosts.old

原创文章,转载请注明: 转载自科技爱好者博客

本文链接地址: 解决ssh连接“Host key verification failed.”故障 (https://www.tujing.site/3649)

如果博客对您有帮助,请给我 赞助


退出移动版