作者:YOUDI(Kevin.U)
安装:
Wget http://samba.anu.edu.au/ftp/rsync/rsync-3.0.3.tar.gz
tar zxvf rsync- 3.0.3 .tar.gz
cd rsync- 3.0.3
./configure
make
make install
设置:
vim rc.local
加入
/usr/bin/rsync --daemon --config=/etc/rsyncd.conf
vi /etc/rsyncd.conf
uid = root
gid = root
max connections = 4
port = 888
hosts allow = 允许主机列表,ip,ip
#hosts deny = 0.0.0 .0/32
[项目名称]
path=项目路径
comment = 备注
read only = yes
auth users = sms,test 允许客户端哪些用户执行
strict modes = false
secrets file = /etc/rsyncd.secrets 认证文件.
rsyncd.secrets
//客户端认证文件
sms:xxxxxxxxxxxxxxxx
test:xxxxxxxxxxxxxxxxx
用户名:密码
客户端执行同步:
rsync --port=888 -vzrtp --progress --delete --password-file=/www/scripts/rsync.passwd sms@office.digilinx.cn::cuc /www/cuc/
rsync –port=端口
v是verbose,z是压缩,r是recursive,topg都是保持文件原有属性如属主、时间的参数。--progress是指显示出详细的进度情况,--delete是指如果服务器端删除了这一文件,那么客户端也相应把文件删除,保持真正的一致
用户@主机名::模块名 路径
rsync.passwd
rsyncd.secrets 客户端认证文件
中的密码
如: xxxxxxxxxxxxxxxxx