Linux-SSH:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED解决方法

来源:互联网 发布:windows 安全 编辑:程序博客网 时间:2024/06/06 15:45

Linux-SSH:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED解决方法:


当ssh 192.168.21.53 时出现一下情况:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:1
RSA host key for 192.168.xxx.xxx has changed and you have requested strict checking.
Host key verification failed.


先more ~/.ssh/known_hosts

可以看到以下内容:

... ... ... ...

192.168.21.53 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQ25kqKE1uT7wtcaFp3zFSMxpwweif0YcKMNmpp4Alql/ZmPHaS/fI1dmXxyzq77wj8uXJgkh7xF0doyFeBk1c8D7jG/5SkAdpwlh6uixYEI3SlRY96InnQd/zEqRGjMvwoEcSmdMdkRsrK5EkPblhDfsQgc5RwKJpkQ+GWXM7oibHZB/P/G2Husnwb0rSwIRvUkwfamM9wDBtA3nEZLcG6wScwm2sZ8SwL9eJMNJXRHR90vewQ6MVrv+k5kB+BSrJ92TH8uZP3R9oO4X6tvRKNZOubQJqKqPDujVrTCD9XnMDb+Mx0yKMqvoGoVBM7fnZMGWtTHBkacsyYSiXaJrV

vi ~/.ssh/known_hosts,编辑这个文件,删除192.168.21.53开头的内容,:wq!保存并退出即可;


原因分析:

It is also possible that a host key has just been changed.

我之前对ssh服务器重装了系统,导致所有与原系统建立过ssh连接的系统都无法再建立连接,因为在于原系统建立首次连接时,双方相互记录了对方的公钥(ssh基于非对称密钥技术),在ssh服务主机重装系统后,公钥改变了,任以旧版本公钥的主机自然是无法与新系统连接的。


网上还有分析为ssh主机被人黑了,并在消除入侵记录时对known_hosts文件做了改动。。。。。


阅读全文
0 0