SSH 报错 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

防崩补丁

1
2
3
4
5
6
7
8
9
10
11
12
13
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 RSA key sent by the remote host is
SHA256:rAJOIPBCrRCUJwA9QIqHclCOj4EDfBw/v71T6g2vIRg.
Please contact your system administrator.
Add correct host key in /Users/chenke/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/chenke/.ssh/known_hosts:13
RSA host key for 104.168.28.60 has changed and you have requested strict checking.
Host key verification failed.

上面这段代码是 Linux/Unix 上连接远程系统有更改时出现的报错。

会出现这些信息是因为,第一次SSH连接时,会生成一个认证,储存在客户端(也就是用SSH连线其他电脑的那个,自己操作的那个)中的known_hosts,但是如果服务器验证过了,认证资讯当然也会更改,服务器端与客户端不同时,就会跳出错误

因此,只要把电脑中的认证资讯删除,连线时重新生成即可。
要删除很简单,只要在客户端输入一个指令

1
ssh-keygen -R IP        # IP 更改为所要连接的服务器 IP
Author: SmallXeon
Link: https://hexo.chensmallx.top/2018/06/19/sshWarning-solution/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
一些推广链接
几个便宜量大的小✈场: FASTLINK, YToo, 论坛邀请注册: ,
便宜量大但是稳定性不足的VPS: , 价格略贵但好用的VPN: , ,