Table of Contents
Rsync Notes
Quick notes on using rsync.
The Server Side
Please see the “SSH Tunnelling” section on running rsync via ssh. This section discusses running the rsync daemon. For the daemon process you need to have a properly configured /etc/rsyncd.conf file. Once you have configured the file correctly, you can start the daemon process. Any changes to the config file will require a restart of the daemon process.
motd file = /etc/rsyncd.motd log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid read only = yes list = yes uid = nobody gid = nobody syslog facility = daemon use chroot = no max connections = 4 lock file = /var/run/rsyncd.lock secrets file = /etc/rsyncd.secrets [public] comment = public rsync share path = /home/user1/pub [private] comment = private rsync share path = /home/user1/az auth users = user1, user5 hosts allow = 1.2.3.4, some.host.com hosts deny = * list = false
The file above has references to other files like /etc/rsyncd.motd and /etc/rsyncd.secrets.
- /etc/rsyncd.motd (message of the day) simply prints a banner to the client.
- /etc/rsyncd.secrets conatins some username:password tuples for authentication against the share. The usernames in this file need not exist as real users on either the client or the server. This file must be chmod 640! An example of this file is shown below:
user1:pass1 user5:passxx
rsync can be run as a daemon in two ways:
From the command line:
> rsync --daemon
From inetd/xinetd. Setting up inetd/xinetd is beyond the scope of these notes.
Be sure that you have opened up port 873 on your firewall for the rsync daemon to be available to rsync clients.
The Client Side
The client side is comparatively easy. The command below will sync up the contents of the “public” share defined in the /etc/rsyncd.conf file above on host.xx.com to /local/path/to/dir
> rsync -avz host.xx.com::public /local/path/to/dir
If the share is private we will need to supply a username and password. This is done by:
> rsync -avz [email protected]::private /local/path/to/dir --password-file=/path/to/password/file
/path/to/password/file above should be chmod 640 and should contain just the password on a single line.
SSH Tunnelling
will write this later