远程主机标识已更改

Posted

技术标签:

【中文标题】远程主机标识已更改【英文标题】:Remote host Identification has changed 【发布时间】:2015-05-26 09:11:57 【问题描述】:

我尝试使用 scp 将文件复制到远程服务器。

sudo scp atlassian-jira-6.4-x64.bin username@ip-adress:/

当我执行时,我得到了错误:

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
(fingerprint)
Please contact your system administrator.
Add correct host key in /var/root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /var/root/.ssh/known_hosts:1
RSA host key for IPADRESS has changed and you have requested strict checking.
Host key verification failed.

所以我从 ~/.ssh 中删除了 known_hosts 文件并再次尝试了该命令。但是仍然有这个消息出现。除了 .ssh 文件夹之外,我还需要在哪里修改我的文件?

【问题讨论】:

ssh remote host identification has changed的可能重复 【参考方案1】:

如果问题重复出现,可以尝试使用这种方法。

将以下行添加到 SSH 配置文件的开头。

Host *
   StrictHostKeyChecking no
   UserKnownHostsFile=/dev/null

或针对特定主机

Host localhost
        HostName localhost
        UserKnownHostsFile=/dev/null
        StrictHostKeyChecking=no

【讨论】:

【参考方案2】:

使用终端上的vim 编辑器编辑以下目录下的known_host 文件。

 vi     /var/root/.ssh/known_hosts OR  /root/.ssh/known_hosts

使用dd 命令删除所有行并使用:wq! 保存known_hosts 文件并重新启动您的sshd 服务。

service sshd restart

【讨论】:

以上是关于远程主机标识已更改的主要内容,如果未能解决你的问题,请参考以下文章

引发 ssh 远程主机标识的所有原因都已更改

markdown SSH远程主机标识已更改

如何摆脱“远程主机标识已更改”消息

检测到可能的 DNS 欺骗。远程主机标识已更改

Ubuntu-ssh - - 警告:远程主机标识已更改 [关闭]

ssh WARNING:REMOTE HOST IDENTIFICATION HAS CHANGED(警告:远程主机标识已更改)