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

[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的正确答案在这里。


当前回答

这是因为您的远程计算机设置已更改。为此删除当前的键。

vim /root/.ssh/known_hosts

删除正在连接的IP所在的线路。

其他回答

当您重新安装服务器时,它的标识发生了变化,您将开始收到这条消息。Ssh无法知道您是否更改了它所连接的服务器,或者在您的网络中添加了一个中间服务器来嗅探您的所有通信—所以它会提醒您注意这一点。

通过删除相关条目,简单地从known_hosts中删除键:

sed '4d' -i /var/lib/sss/pubconf/known_hosts

4d是关于违规RSA…known_hosts:4的账号

The problem is that you've previously accepted an SSH connection to a remote computer and that remote computer's digital fingerprint or SHA256 hash key has changed since you last connected. Thus when you try to SSH again or use github to pull code, which also uses SSH, you get an error. Why? Because you're using the same remote computer address as before but the remote computer is responding with a different fingerprint. Therefore, it's possible that someone is spoofing the computer you previously connected to. This is a security issue.

如果你100%确定远程计算机没有被入侵、被黑客攻击、被欺骗等,那么你所需要做的就是删除远程计算机的known_hosts文件中的条目。这将解决问题,因为连接时将不再与SHA256指纹id不匹配。

在Mac上,我是这么做的:

1)找到输出行为servername读取RSA主机密钥:端口已更改,您已要求严格检查。您需要日志输出中的服务器名和端口。

2)备份SSH已知主机文件“cp /Users/yourmacusername/”。ssh / / yourmacusername / . ssh / known_hosts /用户known_hosts.bak

3)找到存储计算机旧指纹的行,并删除它。您可以使用步骤1中的服务器名和端口搜索特定的违规远程计算机指纹。纳米/用户/ yourmacusername / . ssh / known_hosts

4)按CTRL-X退出,选择Y保存修改

现在输入ssh -p port servername,您将收到您第一次尝试ssh到该计算机时所做的原始提示。然后,您可以选择将远程计算机更新的SHA256指纹保存到known_hosts文件中。如果您正在使用端口22上的SSH,那么-p参数是不必要的。

cp /Users/yourmacusername/.ssh/known_hosts.bak /Users/yourmacusername/.ssh/known_hosts.bak /Users/yourmacusername/.ssh/known_hosts.bak

只做:

cd /home/user/.Ssh / ->这里user将是您的用户名,例如/home/jon/。

然后

Gedit known_hosts &并删除其中的内容。

现在再次使用ssh,它应该可以工作。

这里的其他答案都很好,不管怎样,我通过删除~/.ssh/known_hosts解决了这个问题。这当然可以解决问题,但可能不是最好的方法。

有时,如果出于某种原因,您需要重新安装服务器,当通过ssh连接时,我们会发现您的服务器说标识已更改。 如果我们知道这不是攻击,而是我们已经恢复了系统,我们可以使用ssh-keygen从known_hosts中删除旧的标识:

ssh-keygen -R <host/ip:hostname>
root/.ssh/known_hosts updated.
Original contents retained as /root/.ssh/known_hosts.old

再次连接时,我们将要求您验证新指纹:

ssh -l user <host/ip:hostname>
The authenticity of host '<host/ip:hostname>' can't 
be established.
RSA key fingerprint is 3f:3d:a0:bb:59:24:35:6d:e5:a0:1a:3f:9c:86:81:90.
Are you sure you want to continue connecting (yes/no)? yes