我重新安装了我的服务器,我收到这些消息:

[user@hostname ~]$ ssh root@pong
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 RSA key sent by the remote host is
6e:45:f9:a8:af:38:3d:a1:a5:c7:76:1d:02:f8:77:00.
Please contact your system administrator.
Add correct host key in /home/hostname /.ssh/known_hosts to get rid of this message.
Offending RSA key in /var/lib/sss/pubconf/known_hosts:4
RSA host key for pong has changed and you have requested strict checking.
Host key verification failed.

我尝试了在网上找到的各种解决方案。我的known_hosts文件(通常在~/.ssh/known_hosts中)在/var/lib/ss /pubconf/known_hosts中。我试图编辑它,但它仍然是一个状态。我已经安装了ipa-client和Fedora 19。如何解决此警告?

到目前为止回答的所有答案都只适用于没有安装Freeipa的情况。

下面adrin的评论中关于freeipa的正确答案在这里。


当前回答

使用该命令:

truncate -s 0 /home/SYSTEM_NAME/.ssh/known_hosts

其他回答

我的解决方案是:

六世~ / . ssh / known_hosts 删除包含你想要连接的ip的行。

这比删除所有known_hosts要好

正如许多人已经说过的,使用ssh-keygen,即。

ssh-keygen -R pong

另外,你可以考虑暂时关闭主机按键检查:

ssh -oStrictHostKeyChecking=no root@pong

简单的一行程序解决方案,在mac上测试:

sed '/212.156.48.110/d' ~/.ssh/known_hosts > ~/.ssh/known_hosts

仅从已知主机中删除目标ssh主机IP。

其中212.156.48.110替换为目标主机IP地址。

原因:由于端口转发,目标IP已经为另一台机器所知道。在连接之前删除目标IP将解决此问题。

使用ssh-keygen删除无效密钥:

ssh-keygen -R "you server hostname or ip"

Use

ssh-keygen -R [hostname]

带有ip地址/主机名的示例如下:

ssh-keygen -R 168.9.9.2

这将从known_hosts更新您的主机的违规信息。您还可以使用-f标志提供known_hosts的路径。