rsync在使用中往往会报错误,综合自己亲身经验,总结几条错误的解决方案(IP以10.10.10.10代替):
错误一:
password file must not be other-accessiblecontinuing without password filePassword:rsync客户端路径是否写错,权限设置不对,需要再次输入密码,客户端和服务端的密码文件都应该是600的权限才可以
错误二:
@ERROR: Unknown module ‘bak’rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver= 3.0.3]服务端server的配置中的[bak]名字和客户端client的10.10.10.10::bak不符
错误三:
rsync: failed to connect to 10.10.10.10: Connection timed out (110)rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.6]检查服务端server服务是否正常启动,检查端口防火墙,iptables打开873端口如果服务端是windows server则在防火墙入站规则中增加873端口如果服务端是Linux则先检查服务是否启动#ps aux | grep rsync然后开启873端口#iptables -A INPUT -p tcp --dport 873 -j ACCEPT开启873端口附:安装rsync yum install rsync启动服务/usr/bin/rsync --daemon启动服务错误failed to create pid file /var/rsyncd.pid: File exists看看提示服务错误的路径(这个路径不一定就是这个,看自己的报错路径)这里是/var/rsyncd.pid所以rm -rf /var/rsyncd.pid;再重新启动Rsync服务此时在看一下ps aux | grep rsync启动成功
错误四:
@ERROR: access denied to gmz88down from unknown (10.10.10.10)rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]看看是不是服务端server hosts allow限制了IP,把这里的IP加入到服务端server的hosts allow白名单中,windows rsync不能写多个allow,可以在一个allow中加多个IP,例:hosts allow=10.10.10.10 20.20.20.20
错误五:
@ERROR: chdir failedrsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]服务端server的目录不存在或者没有权限(要同步的那个文件路径),安装windows rsync时候会创建一个SvcCWRSYNC用户,这个用户对要拷贝的目录没有权限,方法一,将这个用户给权限加入到目录中,方法二,修改这个用户隶属于的组,修改后要在管理中重启服务
错误六:
rsync error: error starting client-server protocol (code 5) at main.c(1524) [Receiver= 3.0.7 ]/etc/rsyncd.conf配置文件内容有错误,检查下配置文件
错误七:
rsync: chown "" failed: Invalid argument (22)权限无法复制,去掉同步权限的参数即可
错误八:
@ERROR: auth failed on module bakrsync error: error starting client-server protocol (code 5) at main.c(1530) [receiver=3.0.6]密码错误或服务器上是否有bak模块
错误九:
rsync: connection unexpectedly closed (5 bytes received so far) [sender]rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]模块read only = no设置为no false
错误十:
@ERROR: invalid uid nobodyrsync error: error starting client-server protocol (code 5) at main.c(1503) [sender=3.0.6]设置uid =0gid = 0
错误十一:
rsync: failed to connect to 10.10.10.10: No route to host (113)rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.6]防火墙原因
错误十二:
rsync: read error: Connection reset by peer (104)rsync error: error in rsync protocol data stream (code 12) at io.c(759) [receiver=3.0.6]
/etc/rsyncd.conf配置文件不存在
错误十三:
rsync: Failed to exec ssh: No such file or directory (2)rsync error: error in IPC code (code 14) at pipe.c(84) [receiver=3.0.6]rsync: connection unexpectedly closed (0 bytes received so far) [receiver]rsync error: error in IPC code (code 14) at io.c(600) [receiver=3.0.6]
需要在客户端安装yum install -y openssh-clients即可