首页 > 代码库 > rsync

rsync

参考:http://www.cnblogs.com/itech/archive/2009/08/10/1542945.html

yum -y install rsync

配置文件

vim /etc/rsyncd.conf

# /etc/rsyncd: configuration file for rsync daemon mode

# See rsyncd.conf man page for more options.

# configuration example:

 uid = nobody
 gid = nobody
 use chroot = no
 max connections = 4
 pid file = /var/run/rsyncd.pid
# exclude = lost+found/
# transfer logging = yes
 timeout = 900
# ignore nonreadable = yes
# dont compress   = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2

# [ftp]
#        path = /home/ftp
#        comment = ftp export area
[csmh]
path = /home/wwwroot/csmh
auth users = zhong
ignore errors
secrets file = /etc/rsyncd.secrets
#exclude = cache/
[gjml]
path = /home/wwwroot/gjml
auth users = zhong
ignore errors
secrets file = /etc/rsyncd.secrets
#exclude = cache/
[xian]
path = /home/wwwroot/xian
auth users = zhong
ignore errors
secrets file = /etc/rsyncd.secrets

 密码文件

 vim /etc/rsyncd.secrets

zhong:123456

 客户端同步

从服务端拉取

rsync -avzP zhong@47.93.123.70::csmh rr --delete --password-file=/etc/rsyncd.secrets

/etc/rsyncd.secrets 文件内容为密码

123456

往服务端推送

rsync -avzP /home/tt.txt zhong@47.93.123.70::csmh --delete --password-file=/etc/rsyncd.secrets

rsync