您的位置:首页 > 运维架构 > Linux

Linux SSH 远程登录错误及解决办法 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

2017-08-29 12:37 483 查看
【问题】
[root@MPI_EXERCISE mnt]# scp root@172.16.40.240:/etc/profile.d/motd1.sh /etc/profile.d/
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
c4:8b:39:c7:25:ff:dd:e3:8f:56:d4:d6:1b:8b:98:5b.
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:4
RSA host key for 172.16.40.240 has changed and you have requested strict checking.
Host key verification failed.
[root@MPI_EXERCISE mnt]# ssh 172.16.40.240
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
c4:8b:39:c7:25:ff:dd:e3:8f:56:d4:d6:1b:8b:98:5b.
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:4
RSA host key for 172.16.40.240 has changed and you have requested strict checking.
Host key verification failed.
【分析】
known_hosts是记录远程主机的公钥的文件,之前重装个系统,而保存的公钥还是未重装系统的系统公钥,在ssh链接的时候首先会验证公钥,如果公钥不对,那么就会报错。
【解决办法】
方法一:[root@MPI_EXERCISE mnt]# vim ~/.ssh/known_hosts
删除172.16.40.240的相关rsa的信息即可.
方法二:ssh-keygen -R 172.16.40.240
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ssh