Avatar
Fernando Vásquez is an electronics engineer and software developer currently based in the world. He occasionally blogs about Python and Android programming.

Rsync Tutorial

rsync

(Network efficient file copier: Use the –dry-run option for testing)

  • Only get diffs. Do multiple times for troublesome downloads
rsync -P rsync://rsync.server.com/path/to/file file
  • Locally copy with rate limit. It’s like nice for I/O
rsync --bwlimit=1000 fromfile tofile
# Mirror web site (using compression and encryption)
rsync -az -e ssh --delete ~/public_html/ remote.com:'~/public_html'

# Synchronize current directory with remote one
rsync -auz -e ssh remote:/dir/ . && rsync -auz -e ssh . remote:/dir/

### config ###
yum -y install rsync xinetd # Make sure xinetd and rsync is available, if not type
chkconfig --add xinetd # Add xinetd service to system
chkconfig --list xinetd # Make sure xinetd running on init 3 and 5
vi /etc/xinetd.d/rsync # Enable rsync: change disable = yes into disable = no
vi /etc/rsyncd.secrets # Create username and password for rsync client to use: adminname:hispassword

vi /etc/rsyncd.conf # Create configuration and shares for rsync daemon
chown root.root /etc/rsyncd.* # Secure /etc/rsyncd.*
chmod 600 /etc/rsyncd.* 
service xinetd restart # Restart xinetd
chkconfig --list # Make sure rsync now running

# Perhaps you also want to enable port 873 tcp and udp on your firewall
/usr/local/bin/rsync --no-detach --daemon --config /etc/rsyncd.conf &

all tags