Mac连接远程Linux服务器报错:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

一、错误描述

之前Mac可以正常连接远程Linux主机,远程主机重装系统后,Mac无法连接远程主机。

二、详细错误信息

$ ssh root@x.x.x.x
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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/Yang/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/Yang/.ssh/known_hosts:26
ECDSA host key for x.x.x.x has changed and you have requested strict checking.
Host key verification failed.

三、原因分析

在进行远程连接时,在输入yes后,本机会将远程机器的信息,写到/Users/Yang/.ssh/known_hosts文件中。

因此远程主机重装系统后,本机一定要先清理掉,以便更新信息。

四、解决步骤

在Mac终端输入:vi /Users/wangdong/.ssh/known_hosts

将有远程主机IP的那一段信息删除即可。

点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注

13 − 6 =