SSH命令错误:ECDSA host key "ip地址" for has changed and you have requested strict checking

完整报错信息:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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: ********************************************************
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:14
  remove with:
  ssh-keygen -f "/root/.ssh/known_hosts" -R **.**.**.**
ECDSA host key for **.**.**.** has changed and you have requested strict checking.
Host key verification failed.

其实错误提示里已经提供了解决方法

ssh-keygen -f "/root/.ssh/known_hosts" -R **.**.**.**

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

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

也有文章说直接删除known_hosts文件,效果等同,但是没有那个必要。

你可能感兴趣的:(SSH命令错误:ECDSA host key "ip地址" for has changed and you have requested strict checking)