run rsync as daemon

Running rsync as a daemon is a useful way to ensure rsync performs well. Rsync is typically used with ssh, however using this approach can greatly slow down transfer speed since the data will need to be encrypted during transport. Running as a daemon will eliminate this step and ensure the data gets transferred quicker.

To run it as a daemon requires an rsyncd.conf. This will be file that one will need to create, say as /etc/rsync.conf, for example. An example of how this file looks is as follows:

[module_name]
   path = /path/to/files
   uid = username
   gid = groupname
   auth users = username
   secrets file = /etc/rsyncd.secret

Notice a rsync.secret file can be created as well so that a password can be used. This way the data remains protected.

Once the files are create one can start the rsync daemon as follows:

rsync --config=/etc/rsyncd.conf --daemon

This will run rsync as a daemon and it will run in the background until the host reboots. Be sure to add it as a service so i comes up after a reboot if needed.

Finally, data can be sent from a remote host to the rsync server using the rsync command as well:

rsync –va file.txt rsync://username@hostname/module

By default the rsync daemon uses port 873. Be sure this port is open in your firewall.

Be the first to comment

Leave a Reply