Ubuntu Rsyncd Server

The main purpose of this project was to build a server which could collect information from all of the outlying server and bring them to a central repository system. I like to use it for webserver so that I can have lets say 3 different flavors of linux running legacy systems. Backing those up is very cumbersome so having a CRONTAB job to automatically sync the files back to a central unit makes it much easier to restore them should anything happen to that server. Below is the information on how I created this on Ubuntu 8.10. I am sure it can be changed a bit to work on other systems.
Let install a couple of software apps on the server
apt-get install rsync
apt-get install xinetd

1. Edit /etc/default/rsync to start rsync as daemon using xinetd.
nano /etc/default/rsync

Now look for the following code below and change.

2. Create /etc/xinetd.d/rsync to launch rsync via xinetd.
nano /etc/xinetd.d/rsync

Now paste the information below:
service rsync
      disable         = no
      socket_type     = stream
      wait            = no
      user            = root
      server          = /usr/bin/rsync
      server_args     = --daemon
      log_on_failure  += USERID
3. Create /etc/rsyncd.conf configuration for rsync in daemon mode.
nano /etc/rsyncd.conf

Now paste the following information below:
ax connections = 5
log file = /var/log/rsync.log
timeout = 300

[rbackup] comment = Public Share path = /home/rbackup read only = no list = yes uid = rbackup gid = rbackup auth users = rbackup secrets file = /etc/rsyncd.secrets hosts allow =

4. Create /etc/rsyncd.secrets for user's password.
nano /etc/rsyncd.secrets

Now paste the following information below

Now change the permissions on the file
chmod 600 /etc/rsyncd.secrets

5. Start/Restart xinetd
/etc/init.d/xinetd restart

Now you can test this from another machine
rsync user@

NOTE: is you want to setup a password file you will have to create it on the source server and then change the permissions on the file in order for it to work properly.
nano password

Just enter the password in the file no extra spaces or other characters then chmod the permissions
chmod 600 password

Example of a rsync script
rsync -avz --password-file=/password /DB_Backups/ user@

There are tons of scripts you can run and also changing the flags to preserve the permissions of the files. Have fun!!


Popular posts from this blog

Console over SSH (ONTAP)

Brocade Zone Setup

OpenSolaris ZFS Setup