问题
当使用终端连接服务器时出现以下错误: 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同理。