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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux SSH 远程登录错误及解决办法 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!相关的知识,希望对你有一定的参考价值。

【问题】

[[email protected]_EXERCISE mnt]# scp [email protected]:/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.

[[email protected]_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链接的时候首先会验证公钥,如果公钥不对,那么就会报错。

【解决办法】

方法一:[[email protected]_EXERCISE mnt]# vim ~/.ssh/known_hosts

删除172.16.40.240的相关rsa的信息即可.

方法二:ssh-keygen -R 172.16.40.240  


本文出自 “doublelinux” 博客,谢绝转载!

以上是关于Linux SSH 远程登录错误及解决办法 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!的主要内容,如果未能解决你的问题,请参考以下文章

SSH远程连接报错:Permission denied, please try again.的解决办法备忘

linux 本地无法登录 远程可以登陆的解决办法

某企业Linux下ssh远程登录服务器延迟高问题排查及解决

root用户ssh可以登录,FileZilla sftp不能登录链接CentOS解决办法

[Linux]通过ssh远程登录另一台电脑,无须每次都输入密码的办法:

Ubuntu中不能使用ssh远程登录的解决办法;ssh服务的安装与配置