Organize remote backups with rsnapshot

If you have some customer projects running on webservers (must be accessible to you via ssh) and you would like to regularly backup critical data like mySQL databases or filestructures this post might be useful for you. All you need is a linux box connected to the internet.



  • Shellscripts in /var/remotebackups/_scripts retrieve mySQL-dumps etc. from remote servers and store it in the scripts’ own data/ directory.
  • Those fetch-scripts can be triggered manually or all together via /var/remotebackups/_scripts/
    Example: fetch-script.
  • Scripts must be executed as root or with sudo.
  • Access via scp or ssh to other machines pops up a password dialogue. To prevent this, setup passphraseless keys using the /<user>/.ssh/authorized_keys file on the remote machines and check it by executing something like this without being asked for a password:
    ssh <remote_user>@<remotemachine_or_ip_adr> “cd ~; pwd;”
    This should show you the path to the home directory of <remote_user>
    The howtoforge-page in the head of this file shows you how to do passphraseless authentication.


  • The command “rsnapshot roundrobin” later triggers the roundrobin backup defined in /etc/rsnapshot.conf. All above data is then saved to a new slot in /var/remotebackups/roundrobin.0-9/….
    WARNING: Always execute data aggregation scripts to have a current version of data in each backup-dir prior to executing rsnapshot! Otherwise old data will be saved in a roundrobin slot. The easiest way to do all together is to just execute /var/remotebackups/_scripts/ I do it manually whenever I feel like needing a backup ;). You can easily automate backups using cron.
  • In order to be able to save your snapshots to the 10 mentioned ’roundrobin’-slots of rsnapshot you need this line in your rsnapshot.conf
  • I set a symbolic link from the actual conf-file /etc/rsnapshot.conf to have it all together in /var/remotebackups using this command
    ln -s /etc/rsnapshot.conf /var/remotebackups/


  • To add a new backup do the following:
    (a) Create a dir below /var/remotebackups/_scripts like businex_mysql_blog_synergieraum including a fetch-script like and a data-directory.
    (b) Edit the with credentials so it copies whatever you would like to backup into the data-directory.
    (c) Add the reference to the new fetch-script in /var/remotebackups/_scripts/ in order to have a central triggering script.
    (d) Add the new backup data-directory to your rsnapshot.conf.