使用rsync在两台机器上进行同步的时候经常会遇见下面的错误:

/usr/bin/rsync -ave ssh /from_path root@xxx.xxx.xxx.xx:/to_path
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
ee:bc:b1:d9:e9:f1:cf:c1:1c:6e:34:46:7a:36:08:02.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:8
RSA host key for 130.255.77.163 has changed and you have requested strict checking.
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

解决方法:使用下面命令,其中xxx那部分是目标的IP

ssh-keygen -R xxx.xxx.xxx.xxx
/root/.ssh/known_hosts updated.
Original contents retained as /root/.ssh/known_hosts.old

再次同步发现已经解决

Last modification:December 9th, 2019 at 11:19 am