站点图标 Lee's Blog

Mac和Linux远程连接服务器异常修复(WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!)

问题是这样的,首先阿里的服务器默认有个一个系统安装,在进入这个系统后,可以自行安装其它纯净的系统,第一次ssh上去后,本地会纪录一个密钥,当你机器重新做完,密钥改变,但是Mac本地的密钥并没有更新,具体原因不得而知,在win上使用putty从没有过这种情况。

参考:https://blog.csdn.net/wd2014610/article/details/79945424 这篇文章,最终有解决方案。

SSH~ ⌚ 22:49:52
$ ssh root@47.98.233.15
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:8hgJ8jpcBr1tm6HS72FpXwMrjba8MQqlqYJQLPB/Qf4.
Please contact your system administrator.
Add correct host key in /Users/wangdong/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/wangdong/.ssh/known_hosts:26
ECDSA host key for 47.98.233.15 has changed and you have requested strict checking.
Host key verification failed.

 

以编辑器的方式进入:vi /Users/wangdong/.ssh/known_hosts

找到需要连接的机器的ip,或是域名地址,将后面的乱七八糟的,也就是密钥删掉,然后esc出来,输入:wq保存,具体vi基本操作可以自行搜索。

退出移动版