Categories: 建站技术

ssh连接报错:REMOTE HOST IDENTIFICATION HAS CHANGED

前言

在一次常规vps远程备份,备份失败,提示”REMOTE HOST IDENTIFICATION HAS CHANGED”。远程主机标识被改。后通过查询各种资料后解决失败问题。这里顺道记录解决方法。

问题症状

在源服务器执行网站备份脚本,提示如下报错信息:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ECDSA key sent by the remote host is
3b:ab:8b:a6:2e:bf:4b:aa:4c:82:1e:6e:66:c1:a9:00.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:3
ECDSA host key for 107.173.149.75 has changed and you have requested strict checking.
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]

解决方法

解决方法1

在源vps上,将其/root/.ssh/known_hosts编辑,删除备份vps IP的ECDSA host key,保存再次执行即可实现通信。

解决方法2

使用ssh-keygen命令删除旧密钥,

$ ssh-keygen -R [主机名| IP地址]
Little yu