嘀嘀嘀~~~  页面这在飞快的跑来 . . .

MacSSH连接


问题

当使用终端连接服务器时出现以下错误: WARNING REMOTE HOST IDENTIFICATION HAS CHANGED错误新信息

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:YkDcPSwY9QtAGcsFxPUqSxdtzpsalyJcD4oKrgNW/MY.
Please contact your system administrator.
Add correct host key in /Users/zhouhailin/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/zhouhailin/.ssh/known_hosts:10
ECDSA host key for 118.31.164.51 has changed and you have requested strict checking.
Host key verification failed.

原因:远程服务器变更导致主机的验证失效。

解决

法一:删除.ssh文件夹下的known_hosts文件并重新生成。(也可手动打开文件夹删除)

rm -rf  /root/.ssh/known_hosts

法二:把有问题的主机KEY刪掉

vim /root/.ssh/known_hosts

截图参考

进入失败

进入成功

后续

若是删除了known_hosts文件,则在后面git的push中会出现如下

The authenticity of host 'github.com (xx.xxx.xxx.xx)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])?  

少了一个known_hosts文件,本来密钥文件应该是三个,现在是两个,便报了这样的错误,此时直接yes回车即可,同时生成了缺少了的known_hosts文件。gitee,coding同理。


文章作者: HaiLin Zhou
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 HaiLin Zhou !
评论
  目录