rsyncd.conf
log file = $THE_RSYNC_HOME/log/rsyncd.log
pidfile = $THE_RSYNC_HOME/rsyncd.pid
lock file = $THE_RSYNC_HOME/rsync.lock
hosts allow = *
port = 8300 # if this does not take effect, use --port on cmdline
[home]
path = # the module paht
comment = sync etc from server
uid = $user_name
gid = $group_name
ignore errors
use chroot = no
read only = no
list = no
max connections = 200
timeout = 600
auth users = $user_name
secrets file = $THE_RSYNC_HOME/rsyncd.secrets
rsyncd.secrets
$user_name:$passwd
备注:
1. 文件权限为 600
start.sh
rsync --daemon --port=8300 --config=./rsyncd.conf
client 命令
1. 从 server 同步到 client
rsync -v --port 8300 -r $username@$host::home/the_path/ ./the_path/
2. 从 client 同步到 server
rsync -vc --port 8300 -r ~/the/code/dir $username@$host::home/the_path/