SSH连接至 Linux 服务器时,提示 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!的解决方法

SSH连接至 Linux 服务器(ssh 10.229.142.30)时,出现以下错误:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 ECDSA key sent by the remote host is
d7:a3:d6:e1:d6:a8:4f:64:d9:87:08:43:55:c5:a5:1d.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:30
ECDSA host key for 10.229.142.30 has changed and you have requested strict checking.
Host key verification failed.

 

出现这个问题的原因是,第一次使用SSH连接时,会生成一个认证,储存在客户端的known_hosts中.

可使用以下指令查看:

ssh-keygen -l -f ~/.ssh/known_hosts

由于服务器重新安装系统了,所以会出现以上错误。

解决方法:

ssh-keygen -R 服务器端的ip地址


这里的执行:ssh-keygen -R 10.229.142.30  

此命令是重新生成认证密钥。

执行完上面的命令后,再执行ssh 10.229.142.30,

出现以下提示:

The authenticity of host '10.229.142.30 (10.229.142.30)' can't be established.
ECDSA key fingerprint is d7:a3:d6:e1:d6:a8:4f:64:d9:87:08:43:55:c5:a5:1d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.229.142.30' (ECDSA) to the list of known hosts.
Password:

输入密码,就可以啦。

发布了99 篇原创文章 · 获赞 60 · 访问量 30万+

猜你喜欢

转载自blog.csdn.net/lengyuewusheng99/article/details/77716519