我就是不知道我的 RSync 发生了什么事。我在 RHEL5 上运行 RSync,ip = xx.xx.xx.97。它从 RHEL5 获取文件,ip = xx.xx.xx.96。
这是日志(我在 RSync 命令行上指定的)在 xx.97(请求文件的日志)上显示的内容:
(local time)
2015/08/30 13:40:01 [17353] @ERROR: auth failed on module tomcat_backup
2015/08/30 13:40:01 [17353] rsync error: error starting client-server protocol (code 5) at main.c(1530) [receiver=3.0.6]
这是日志(在 rsyncd.conf 文件中指定)在 xx.96(提供文件的那个)上显示的内容:
(UTC time)
2015/08/30 07:40:01 [8836] name lookup failed for xx.xx.xx.97: Name or service not known
2015/08/30 07:40:01 [8836] connect from UNKNOWN (xx.xx.xx.97)
2015/08/30 07:40:01 [8836] auth failed on module tomcat_backup from unknown (xx.xx.xx.97): password mismatch
这是从 xx.xx.xx.97(请求者)调用的实际 rsync.sh 命令:
export RSYNC_PASSWORD=rsyncclient
rsync -havz --log-file=/usr/local/bin/RSync/test.log rsync://[email protected]/tomcat_backup/ProcessSniffer/ /usr/local/bin/ProcessSniffer
这是 xx.xx.xx.97 上的 rsyncd.conf:
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
[files]
name = tomcat_backup
path = /usr/local/bin/
comment = The copy/backup of tomcat from .96
uid = tomcat
gid = tomcat
read only = no
list = yes
auth users = rsyncclient
secrets file = /etc/rsyncd.secrets
hosts allow = xx.xx.xx.96/255.255.255.0
这是 xx.xx.xx.97 上的 rsyncd.secrets:
files:files
这是 xx.xx.xx.96(文件提供者)上的 rsyncd.conf:
注意:有一个'cwrsync'(rsync的Windows版本)成功也调用文件(xx.xx.xx.100)
注意:是的,xx.96 有可能向 xx.97 请求文件。然而,这实际上并没有发生。
它被注释掉了 init.d 机制。
lock file = /var/run/rsync.lock
log file = /var/log/rsync.log
pid file = /var/run/rsync.pid
strict modes = false
[files]
name = tomcat_backup
path = /usr/local/bin
comment = The copy/backup of tomcat from xx.97
uid = tomcat
gid = tomcat
read only = no
list = yes
auth users = rsyncclient
secrets file = /etc/rsyncd.secrets
hosts allow = xx.xx.xx.97/255.255.255.0, xx.xx.xx.100/255.255.255.0
这是 xx.xx.xx.97 上的 rsyncd.secrets:
files:files
那是别的东西。我有一个调用 rsync 命令的脚本,这导致了问题。实际的 rsync 命令行是可以的。 抱歉。
这就是我遇到此错误时所经历的情况。我的第一个想法是检查 rsync 服务器日志。并且不在
rsync.conf
中配置的地方。然后我检查了systemctl status rsyncd
中打印的日志
rsyncd[23391]: auth failed on module signaling from unknown (172.28.15.10): missing secret for user "rsync_backup"
rsyncd[23394]: Badly formed boolean in configuration file: "no # rsync daemon before transmission, change to the root directory and limited within.".
rsyncd[23394]: params.c:Parameter() - Ignoring badly formed line in configuration file: ignore errors # ignore some io error informations.
rsyncd[23394]: Badly formed boolean in configuration file: "false # if true, cannot upload file to this server.".
rsyncd[23394]: Badly formed boolean in configuration file: "false # if true, cannot download file from this server.".
rsyncd[23394]: Badly formed boolean in configuration file: "false # if true, can only list files here.".
结合日志配置不发挥作用的事实。看来rsync.conf中每行配置后面的注释都会使配置无效。所以我删除了那些
# ...
并重新启动rsyncd。