作者:YOUDI(Kevin.U)
安裝:
Wget http://samba.anu.edu.au/ftp/rsync/rsync-3.0.3.tar.gz
tar zxvf rsync-<?XML:NAMESPACE PREFIX = ST1 />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 [email protected]::cuc /www/cuc/
rsync –port=端口
v是verbose,z是壓縮,r是recursive,topg都是保持文件原有屬性如屬主、時間的參數。--progress是指顯示出詳細的進度情況,--delete是指如果服務器端刪除了這一文件,那麼客戶端也相應把文件刪除,保持真正的一致
用戶@主機名::模塊名 路徑
rsync.passwd
rsyncd.secrets 客戶端認證文件
中的密碼
如: xxxxxxxxxxxxxxxxx