Server
======
Put rsyncd.conf to /etc/xinetd.d/ .
Put rsyncd.secrets to /etc.
Then turn on rsync service: chkconfig rsync on
Client
======
Edit a text file contained your password and named “password”.
Then,
export RSYNC_RSH=/usr/bin/ssh
Run this to get the source from rsync server:
rsync -vzrtopg –progress –delete root@172.16.97.212::cpp . –password-file=/root/password
If you modified some thing, want to put them to rsync, run this command:
rsync -vzrtopg –progress –delete . root@172.16.97.212::cpp –password-file=/root/password
Notice
======
1. Server: The owner and permission of secret file must be correct! (0600)
2. Client: The owner and permission of password file must be correct, too!! (0600)
3. You may refer the log file to find why error happened.
rsyncd.conf
===========
uid = root
gid = root
use chroot = no
max connections = 4
syslog facility = local5
pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log
lock file = /var/run/rsync.lock
[cpp]
path = /root/cpp
comment = root
ignore errors
read only = no
list = yes
auth users = root
secrets file = /etc/rsyncd.secrets
rsyncd.secrets
==============
root:your-password
rsyncd usual syntax
===================
rsync -a srcdir remotehost:/destdir # Local -> Remote
rsync -a remotehost:/srcdir destdir # Remote -> Local
rsync -a -e ssh srcdir user@remotehost:/destidr # via SSH
rsyncd switchs
==============
-n Dry-Run, only simulate rsyncing.
-v,-vv,-vvv verbose.
–delete Remote all files in destination that doesn’t appear in source.
–delete-exclude Like –delete, but exclude specified files.
-z With compression.
-s Efficient with sparse files.
-b Append ‘~’ for existed files in destication.
–backup-dir=DIR Move existed files in destincation to DIR.
–exclude FILE Exclude specified files.