解决远程服务器重置ssh无法连接的问题

    技术2025-10-01  21

    问题:使用阿里云服务器,重置了一次系统,结果发现使用远程ssh无法连接,并且报了下边的错:

    @ 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 33:78:e5:9a:e8:c5:47:73:81:a3:9b:4c:b0:ed:af:2d. 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:2 Password authentication is disabled to avoid man-in-the-middle attacks. Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

    原因:出现这个问题的原因,是我重置了系统,服务器主体变了,原先连接生成的认证不能使用了,所以需要将原先的认证删除。

    解决方案:

    ssh-keygen -R [你要连接的IP]

    之后进行连接即可连接成功:

    Processed: 0.011, SQL: 9