rsync配置

服务器端:
配置:
vcloud@vcloud:~$ cat rsyncd.conf
pid file=/home/vcloud/rsyncd.pid
log file=/home/vcloud/rsyncd.log
lock file = /home/vcloud/rsyncd
port = 8724

#limit clients, private ip
hosts allow=10.171.160.229 10.164.97.28 10.164.96.203

[liveDomain]
        comment = liveDomain
        path = /home/vcloud/liveDomain
        use chroot = no
        max connections=32
        read only = no
        list = no
        uid = vcloud
        gid = vcloud
        strict modes = yes
        auth users = vcloud
        secrets file = /home/vcloud/rsync.pass
        ignore errors = no
        ignore nonreadable = yes
        transfer logging = no
        timeout = 600
        refuse options = checksum dry-run
        dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz
        exclude = .svn/ .git/

密码文件:/home/vcloud/rsync.pass
权限需要600。
密码格式为: vcloud:123456    (中间为单个冒号,auth user最好为系统用户)

启动脚本: /usr/bin/rsync --daemon --config=/home/vcloud/rsyncd.conf --port=8724
注意配置log file,方便查看错误。

客户端:
rsync -avz --port=8724 /home/allan/dnsLog/dns.INFO  [email protected] ::liveDomain
rsync -avz --port=8724 --password-file=/etc/rsyncd/rsyncd.pass /home/tools/readme.txt  [email protected] ::liveDomain (格式为两个冒号后跟服务端配置的module名,即[liveDomain]

常见错误:
1、客户端显示验证错误
@ERROR: auth failed on module liveDomain
rsync error: error starting client-server protocol (code 5) at main.c(1534) [sender=3.0.9]
检查两端的用户、密码是否一致。检查服务器端设置的密码文件路径是否正确,权限是否正确(600)。

2、运行 rsync -avz --port=8724 /home/allan/dnsLog [email protected]::/home/vcloud/liveDomain
返回: ERROR: The remote path must start with a module name not a /
rsync error: error starting client-server protocol (code 5) at main.c(1534) [sender=3.0.9]
服务端目标不能使用路径(::/home/vcloud/liveDomain),必须使用module名字( ::liveDomain

你可能感兴趣的:(Linux,CDN,Ops)