运维dog
2021-08-07 22:49
采纳率: 100%
浏览 17

在设置完免密登陆后,用ssh ip登陆 出现如下错误

当自己在ssh 登陆另一台服务器的时候,出现以下错误:

[root@test01 ~]# ssh root@172.16.0.118
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
SHA256:TBdOjhzVPapIMjsMWKZq5RYYwb3TSjzJ2PeGgFLaUws.
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:1
ECDSA host key for 172.16.0.118 has changed and you have requested strict checking.
Host key verification failed.

  • 收藏

1条回答 默认 最新

  • 一条coding 2021-08-07 22:54
    已采纳

    此错误说明是此服务器中的公钥钥匙,连接不了对方的服务器,可能是对方服务器的公钥发生改变,所以,需要在本地更新公钥;

    有如下解决方案:
    1、可以直接ssh-keygen -R ip
    直接更新对接公钥;
    例如,我需要连接的ip是172.16.0.118,则:

    [root@VIP01 ~]# ssh-keygen -R 172.16.0.118 ssh-keygen -R 172.16.0.118
    2、进入known_hosts 此文件中,删除关于对方IP的公钥;
    例如,我需要连接的服务器为172.16.0.118,那么只需要删除关于这台服务器的公钥即可,如下:

    [root@VIP01 .ssh]# vi known_hosts
    [ root@VIP01.ssh mailto:root@VIP01.ssh ]# vi known_hosts

    192.168.6.55 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAylzdHAyNTYAAABBBF00Sc6O50yEnc+DNL2W3/kkt+1sgagdB6ORvTHOn/dB0rHumibGct0VniCwR7sxmTh+rWvJVmUio=
    172.16.0.118 ecdsa-sha2-nistp256 AAAAE2VjItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAu2VujlpwoQRsCy5BjXQd47pm1s2qdBMtxolLYluXYH42GO+6YnUIc7vkFIEygJhEbIoOi3U/k+s=
    删除以上172.16.0.118的一行信息即可;

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题