ssh连接密钥重置 REMOTE HOST IDENTIFICATION HAS CHANGED!

 

SSH连接时,出现提示远程密码重置的报错

[root@docker tools]# ssh 172.17.0.2
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 RSA key sent by the remote host is
A256:egegjw6C/fb8Oy/Ipkt41NBTHhWNVwU1Hq1Jg/tp9q8.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /root/.ssh/known_hosts:3
RSA host key for 172.17.0.2 has changed and you have requested strict checking.
Host key verification failed.

先查看文件在哪里

[root@docker tools]# cat /root/.ssh/known_hosts
172.17.0.2 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzQu4f6rXtaWxPqU7MSTbRkn2NbNGNef5pwzIH+MrNWWCsXft2MjraMtXq5R5/EF7Bxpi2XSPcx4i6YMNjAz+muRwM/riaupCCQx3doAm0zLKk14LNFil8gRswIQsUS98rHAR6xtaC4I/tW0ISQB/7ssLbc9S6dRTDTNsiaan3g/KIXXUM1cmQDKQBA7ok3t0iYDwCGJjEcx6+MAvdKQjQbvYmGqc9QSDIaPwpoKFLsjltBgjZQDeB2t97UOYcduIF7eVg2wWdxLDJkLEfwT1OS5qYh9J1BwiulqhJdj7wiFf8A5R6wqKBpjnjSS9a6vcYHh3Mi8M2QoekF6dRZSz6Q==

删除本地的SSH-RSA即可

[root@docker tools]# ssh-keygen -R 172.17.0.2
# Host 172.17.0.2 found: line 3
/root/.ssh/known_hosts updated.
Original contents retained as /root/.ssh/known_hosts.old


最后重新SSH连接即可成功

[root@docker tools]# ssh 172.17.0.2
The authenticity of host '172.17.0.2 (172.17.0.2)' can't be established.
RSA key fingerprint is SHA256:egegjw6C/fb8Oy/Ipkt41NBTHhWNVwU1Hq1Jg/tp9q8.
RSA key fingerprint is MD5:73:9b:3e:c3:93:10:d9:17:74:af:ff:a9:67:59:47:80.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.17.0.2' (RSA) to the list of known hosts.
root@172.17.0.2's password:
[root@f02cc1f8d0dd ~]#

除此之外,也可以直接删除rsa

rm -rf /root/.ssh/*


————————————————
版权声明:本文为CSDN博主「棒棒吃不胖」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/oldboy1999/article/details/125232175

 

posted on 2023-04-14 16:41  lzlvv  阅读(202)  评论(0编辑  收藏  举报

导航