ssh远程主机标识已更改

本文翻译自:ssh remote host identification has changed

I've reinstalled my server and I am getting these messages: 我重新安装了我的服务器,我收到这些消息:

[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.

I have tried various solutions that I found on the internet. 我尝试过在互联网上找到的各种解决方案。 My known_hosts file (normally in ~/.ssh/known_hosts ) is in /var/lib/sss/pubconf/known_hosts . 我的known_hosts文件(通常在~/.ssh/known_hosts )位于/var/lib/sss/pubconf/known_hosts I've tried to edit it, but it remains in one state. 我试过编辑它,但它仍处于一种状态。 I have installed ipa-client and have Fedora 19. How do I resolve this warning? 我安装了ipa-client并安装了Fedora 19.如何解决此警告?

All the answers answered so far works only if you do not have Freeipa installed. 到目前为止回答的所有答案只有在您没有安装Freeipa时才有效。

Right answer for freeipa in comments below from adrin here . 正确的答案,从adrin下面的评论freeipa 这里


#1楼

参考:https://stackoom.com/question/1PRRE/ssh远程主机标识已更改


#2楼

When you reinstall the server its identity changes, and you'll start to get this message. 当您重新安装服务器时,其身份会发生变化,您将开始收到此消息。 Ssh has no way of knowing whether you've changed the server it connects to, or a server-in-the-middle has been added to your network to sniff on all your communications - so it brings this to your attention. Ssh无法知道您是否已更改其连接的服务器,或者已将中间服务器添加到您的网络以嗅探您的所有通信 - 因此它会引起您的注意。

Simply remove the key from known_hosts by deleting the relevant entry: 只需删除相关条目,即可从known_hosts中删除密钥:

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

The 4d is on the account of Offending RSA ...known_hosts:4 4dOffending RSA ...known_hosts:4


#3楼

I had this same error occur after I recreated a Digital Ocean Ubuntu image. 重新创建数字海洋Ubuntu图像后,我发生了同样的错误。 I used the following command with my server IP in place of [IP_ADDRESS] 我使用以下命令和我的服务器IP代替[IP_ADDRESS]

ssh-keygen -R [IP_ADDRESS]

#4楼

Here is the simplest solution 这是最简单的解决方案

ssh-keygen -R <host>

For example, 例如,

ssh-keygen -R 192.168.3.10

From ssh-keygen man page : ssh-keygen手册页

  • -R hostname Removes all keys belonging to hostname from a known_hosts file. -R hostname从known_hosts文件中删除属于-R hostname所有密钥。 This option is useful to delete hashed hosts (see the -H option above). 此选项对于删除散列主机很有用(请参阅上面的-H选项)。

#5楼

Use 使用

ssh-keygen -R [hostname]

Example with an ip address/hostname would be: ip地址/主机名的示例如下:

ssh-keygen -R 168.9.9.2

This will update the offending of your host from the known_hosts. 这将从known_hosts更新主机的违规行为。 You can also provide the path of the known_hosts with -f flag. 您还可以使用-f标志提供known_hosts的路径。


#6楼

I used the solution of mockinterface, though the sed -i didn't quite work I solved it by deleting the line by hand with vim: 我使用了模拟接口的解决方案,虽然sed -i不太起作用我通过用vim手动删除行来解决它:

sudo vim /var/lib/sss/pubconf/known_hosts

You can use any other text editor you want, but probably you'll need to show your administrative privileges 您可以使用任何其他所需的文本编辑器,但可能需要显示您的管理权限

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值