ssh连接远程服务器出现Host key verification failed. lost connection问题的解决

1.问题如下:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:UggbFShWZWxVBwyKHyYcCIkTNsl+r9Awg8Mv0E7mq5c.
Please contact your system administrator.
Add correct host key in /home/python/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/python/.ssh/known_hosts:1
  remove with:
  ssh-keygen -f "/home/python/.ssh/known_hosts" -R 39.108.71.7
ECDSA host key for 39.108.71.7 has changed and you have requested strict checking.
Host key verification failed.
lost connection

2.原因分析

    在主机子系统每次成功ssh连接远程操作,都会把你每个你访问过计算机的公钥(public key)都记录在主机的目录/Users/icarus/.ssh/known_hosts下,当下次访问相同子机服务器时,会核对公钥。如果公钥不同,会发出警告,避免你受到DNS Hijack之类的攻击。

3.解决方法 

进入目录删除文件即可,然后重新连接就能发现连接上了。

cd  ~/.ssh/
rm  known_hosts

即可完美解决!

如果你和我有共同爱好,我们可以加个好友一起交流哈!

猜你喜欢

转载自blog.csdn.net/ywk_hax/article/details/83045197
今日推荐