ssh不能连接 提示WARNING: POSSIBLE DNS SPOOFING DETECTED!处理方法

问题: 通过SSH连接某台服务器的时候出现错误

[root@tw]# ssh xxx.xxx.xxx.xxx

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!         @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
25:d7:4d:2f:2d:87:9d:5a:fe:d2:c3:d9:a4:e7:4c:9e.
Please contact your system administrator.
Add correct host key in /home/XXX/.ssh/known_hosts to get rid of this message.
Offending key in /home/sjcool/.ssh/known_hosts:3

RSA host key for [218.XXX.XXX.XXX]:22 has changed and you have requested strict checking.


解决方法:vi /root/.ssh/known_hosts 删除掉那个IP对应的公钥,保存退出再连接就可以了


解释

用OpenSSH的人都知ssh会把你每个你访问过计算机的公钥(public key)都记录在~/.ssh/known_hosts。当下次访问相同计算机时,OpenSSH会核对公钥。如果公钥不同,OpenSSH会发出警告,避免你受到DNS Hijack之类的攻击。因此我们现在只需要删除knows_hosts文件中所对应的IP节点的公钥,然后再ssh IP地址就可以了。


你可能感兴趣的:(ssh不能连接 提示WARNING: POSSIBLE DNS SPOOFING DETECTED!处理方法)