解决方案

删除文件中提到的“Offending key in ~/.ssh/known_hosts:<line number>”的那一行。

原因

这是由于 ssh 会话生成的 RSA 密钥和 记录在 ~/.ssh/known_hosts:<line number> 的上一个密钥不同。
实际中一般两个服务器互换IP 就会出现这个问题。

ssh Host key verification failed

尝试 ssh 或者 scp 到 ssh 服务器时显示以下错误:

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
00:00:00:00:00:00:00:00:00:00:00:00:.
Please contact your system administrator.
Add correct host key in ~/.ssh/known_hosts to get rid of this message.
Offending key in ~/.ssh/known_hosts:xx
RSA host key for domain-name.com has changed and you have requested
strict checking.

Host key verification failed.
主机密钥验证失败。

lost connection
日期:2020-06-02 22:17:17 来源:oir作者:oir