Dave's Brain

Browse - Computer Tips - How can I send a backup to an rsync server?

Date: 2010jun7
OS: Linux
Product: rsync

Q.  How can I send a backup to an rsync server?

A.  ON THE SERVER SIDE.

Make a user to own the backup:

useradd backupuser
Set up the server in /etc/rsyncd.conf for example:
[myphotos] uid = backupuser gid = backupuser readonly = false path = /backups/myphotos comment = Photos I have taken myself auth users = rsync secrets file = /etc/rsyncd.secrets
Make the secrets file /etc/rsyncd.secrets backupuser:myPASS
Start the server:
/bin/service rsync start
ON THE CLIENT SIDE. Make a script, called for example /usr/local/bin/backup_myphotos
#!/bin/sh export USER=backupuser export RSYNC_PASSWORD=myPASS rsync --archive --compress -v /home/myphotos/ myserver::myphotos # The trailing slash after your source folder (/home/myphotos/) # is important because it requests a backup of the cotents of the folder. # I used to use the --checksum option but it became too slow.
Run your script with cron.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.