目的: 從old_server遷移到new_server, 目錄都爲/data/john
old_server:
$cat rsyncd.conf
pid file = ./rsyncd.pid
port = 873
address = 100.81.140.50
uid = john
gid = users
use chroot = yes
read only = yes
hosts allow=192.168.1.0/255.255.255.0 10.218.78.9
hosts deny=*
max connections = 100
log file = ./rsync.log
transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
[data]
path = /data/john
list=yes
ignore errors
auth users = rsync_john
secrets file = ./rsyncd.secrets
comment = data
exclude = lost+found
$sudo cat rsyncd.secrets
rsync_john:rsyncpassword
$ls -l rsyncd.secrets
-rw------- 1 root root 27 5月 26 11:16 rsyncd.secrets
sudo rsync --daemon --config=./rsyncd.conf
new:
列舉rsync目錄:
rsync --list-only [email protected]::data
輸入:rsyncpassword
同步到本地當前目錄
rsync -avzP [email protected]::data .