系统环境是 ubuntu 11.10  server sudo cp /usr/share/doc/rsync/exmple/rsyncd.conf /etc/ 需要的修改 $sudo vim /etc/default/rsync RSYNC_ENABLE=true 我的配置文件内容: # sample rsyncd.conf configuration file # GLOBAL OPTIONS #motd file=/etc/motd log file=/var/log/rsyncd # for pid file, do not use /var/run/rsync.pid if # you are going to run rsync out of the init.d script. pid file=/var/run/rsyncd.pid #syslog facility=daemon #socket options= # MODULE OPTIONS [shops]         comment = public archive         path = /var/cdn/shops         use chroot = no "test1" 119L, 3550C                                                                                               1,0-1         Top         path = /var/cdn/shops         use chroot = no         max connections=6         lock file = /var/lock/rsyncd # the default for read only is yes...         read only = yes         list = yes         uid = craxyz         gid = craxyz #       exclude = #       exclude from = #       include = #       include from =         auth users = craxyz         secrets file = /etc/rsyncd.pass         strict modes = yes #       hosts allow = #       hosts deny =         ignore errors = no         ignore nonreadable = yes         transfer logging = no #       log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.         timeout = 600         refuse options = checksum dry-run         dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz 创建一个密码文件(就是配置文件中指定的那个哦, secrets file = /etc/rsyncd.pass,不是默认的名字了。) $sudo vim /etc/rsyncd.pass craxyz:****** $sudo chmod 0600 /etc/rsyncd.pass 启动rsync sudo /etc/init.d/rsync start client $rsync -vzrtogu --progress craxyz@192.168.0.53::shops(服务端定义的字段名) . (绝对路径和相对路径均可,此处是已经在目标目录) 输入密码~~ 出现下面信息--成功 sent 2517 bytes  received 2161202 bytes  865487.60 bytes/sec total size is 2169700  speedup is 1.00 crontab执行 创建需要自动读取的密码文件(其实就是免去我们需要输入的密码) $sudo vim /home/sysadmin/test/rsyncd.pass输入******,保存,(******是服务段认证用户的密码) 注意: sudo chmod 600 /home/sysadmin/test/rsyncd.pass 然后我们打开crontab,加入以下任务 $crontab -e * */1 * * * rsync -vzrogu --password-file=/home/sysadmin/test/rsyncd.pass craxyz@192.168.0.53::shops /var/cdn/shops 遇到的报错信息 报错信息如下: @ERROR: auth failed on module shops rsync: connection unexpectedly closed (0 bytes received so far) [receiver] rsync error: error in rsync protocol data stream (code 12) at io.c(359) 查看rsync服务器端的日志文件有如下提示  secrets file must not be other-accessible (see strict modes option)  continuing without secrets file 服务器端/etc/rsyncd.pass的密码文件权限不对,应为600,将该文件的权限更改为600后同步正常。  (要重启服务生效) 总结:服务器端的rsync的密码文件格式为username:password,权限为600 客户端密码文件格式为password,需同服务器端,权限为600,否则同 步会报错 还有一个问题就是密码文件中的用户名的问题.如果遇到其他的错误信息应该要检查下用户名和密码的正确性.