ssh远程登录失败

yliunx@myliunx-ThinkPad-T14-Gen-1:~$ ssh zxb@192.168.3.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 a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:15j8l5UKYC9Lx+qE5PmEpY7Hrtj2WElwCn4SQl5hOIw.
Please contact your system administrator.
Add correct host key in /home/myliunx/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/myliunx/.ssh/known_hosts:1
remove with:
ssh-keygen -f “/home/myliunx/.ssh/known_hosts” -R “192.168.3.240”
ECDSA host key for 192.168.3.240 has changed and you have requested strict checking.
Host key verification failed.

解决办法:

解决方案:在终端上输入以下命令:

ssh-keygen -R “你的远程服务器ip地址

目的是清除你当前机器里关于你的远程服务器的缓存和公钥信息,注意是大写的字母“R”。

原因分析:根据个人的情况,原因是我的云服务器重装了系统(清除了与我本地SSH连接协议相关信息),本地的SSH信息便失效了,使用SSH连接相同的ip地址时使用的是失效的协议信息,所以会报错,使用上述命令便可以清除known_hosts里旧缓存文件

留下评论