问题1:无法向远程机器拉取数据,报错如下:
[root@rsync-41 ~]#rsync -avzP /test [email protected]:/var/log @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 SHA256:3SkwUKIzfF3RqsDetlchXQSNOxaGmVGSq9+5N2lckww. 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 10.0.0.31 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]
意思是/root/.ssh/known_hosts 已经存在链接31机器的ECDSA host key
方法一:删除此机器 /root/.ssh/known_hosts 文件中关于31的key
方法二,设置永久不记录key
vi ~/.ssh/config 编辑配置文件,添加以下两行代码,然后重启:
StrictHostKeyChecking no UserKnownHostsFile /dev/null
问题2:通过rsync服务客户端向服务端传输数据失败
[root@nfs-31 /backup/nfs-31_10.0.0.31_2023-11-30]#rsync -avzP --password-file=/etc/my_rsync.pwd /backup/$(hostname)_$(ifconfig eth0 | awk 'NR==2{print $2}')_$(date '+%F')/* [email protected]::backup @ERROR: chdir failed rsync error: error starting client-server protocol (code 5) at main.c(1656) [sender=3.1.2]
报错原因:服务端不存在存放数据的目录
解决办法:创建对应目录,并配置好属组
mkdir /back chown -R bba:bba /back/
标签:rsync,host,报错,ssh,key,整理,root From: https://www.cnblogs.com/yun88/p/17863800.html