昨晚小版本上线,使用rsync往服务器上传文件时,client报如下异常:
@ERROR: auth failed on module backup
rsync error: error starting client-server protocol (code 5) at main.c(1503) [Receiver=3.0.6]
首先:检查server端和client端的用户名和密码确认都无误;
服务器端检查这个/etc/rsync.pass密码文件,
注:其它系统可能密码文件名字不一样可以在配置文件中搜索cat /etc/rsyncd.conf | grep -i secrets 来确认密码文件的名字
不建议用ps -ef | greep -i rsync 因为如果rsync被设置成守护进程启动的,进程只显示为xinetd,所以用ps的命令搜不到
然后:检查了服务器端/etc/rsyncd.conf 配置文件未发现异常,
$ cat /etc/rsyncd.conf | grep -i log
log file = /var/log/rsync.log
查看/var/log/rsync.log发现
2017/07/21 09:38:33 [31746] name lookup failed for xxx.xx.xxx.xx: Name or service not known
2017/07/21 09:38:33 [31746] connect from UNKNOWN (xxx.xx.xxx.xx)
2017/07/21 09:38:33 [31746] auth failed on module ci from unknown (xxx.xx.xxx.xx): missing secret for user "pesdfk"
google搜索一下,发现其它网友解决方案,在server的/etc/hosts里加上IP和主机名的映射,我没有采用该建议。因为这个系统一直是我在维护,上周还有版本上线
运行都正常。
主要还是围绕客户端的@ERROR: auth failed on module backup在猜想,肯定是用户验证出了异常。
又google了一下,看到有网友提示,server端rsync.pass文件的格式user:passwrod , 修改成user:passwrod后在client端重新上传文件正常。
奇怪的是之前一直都正常,而且rsync.pass上次修改日期是2016年。
附录:rsync常见问题及解决办法 (转载自:http://kkkkkk.blog.51cto.com/468162/1194202)
问题一:
@ERROR: chroot failed
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3]
问题二:
@ERROR: auth failed on module tee
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3]
原因:
服务器端该模块(tee)需要验证用户名密码,但客户端没有提供正确的用户名密码,认证失败。
提供正确的用户名密码解决此问题。
问题三:
@ERROR: Unknown module ‘tee_nonexists’
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3]
原因:
服务器不存在指定模块。提供正确的模块名或在服务器端修改成你要的模块以解决问题。
#####################################################################
问题1:
在client上遇到问题:
rsync -auzv --progress --password-file=/etc/rsync.pas /home/
rsync: could not open password file "/etc/rsync.pas": No such file or directory (2)
Password:
@ERROR: auth failed on module backup
rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7]
遇到这个问题:client端没有设置/etc/rsync.pas这个文件,而在使用rsync命令的时候,加了这个参数--
password-file=/etc/rsync.pas
问题2:
rsync -auzv --progress --password-file=/etc/rsync.pas /home/
@ERROR: auth failed on module backup
rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7]
遇到这个问题:client端已经设置/etc/rsync.pas这个文件,里面也设置了密码111111,和服务器一致,但是
服务器段设置有错误,服务器端应该设置/etc/rsync.pas ,里面内容root:111111 ,这里登陆名不可缺少
问题4:
rsync: write failed on "/home/backup2010/wensong": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(302) [receiver=3.0.7]
rsync: connection unexpectedly closed (2721 bytes received so far) [generator]
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [generator=3.0.7]
磁盘空间不够,所以无法操作。
可以通过df /home/backup2010 来查看可用空间和已用空间
3、服务未启动
rsync: failed to connect to 10.10.10.170: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]
启动服务:rsync --daemon --config=/etc/rsyncd.conf
4、磁盘空间满
rsync: recv_generator: mkdir "/teacherclubBackup/rsync……" failed: No space left on device (28)
*** Skipping any contents from this failed directory ***
5、Ctrl+C或者大量文件
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [receiver=3.0.5]
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [generator=3.0.5]
6、xnetid启动
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.5]
查看rsync日志
rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory
xnetid查找的配置文件位置默认是/etc下,根据具体情况创建软链接。例如:
ln -s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf
或者更改指定默认的配置文件路径,在/etc/xinetd.d/rsync配置文件中