Remote Backup with RSync

From ALSwiki
Jump to: navigation, search

A detailed description of how to do this is here: http://linuxgazette.net/104/odonovan.html

A Sample rsync command that I use is:

$ rsync -e ssh -av user@alstevens.org:/home/astevens/wiki.alstevens.org /pathto/wiki.alstevens.org

Set up public/private-key security

$ ssh-keygen -b 1024 -t rsa -f /home/username/.ssh/id_rsa
  (do not enter a pass-phrase - leave it blank)
$ scp /home/username/.ssh/id_rsa.pub user@alstevens.org:/home/username/.ssh/authorized_keys

The latter is a file. If you are adding other keys, cat them on to the file. To see what's already in the crontab:

$ crontab -l

Add the rsync command to the crontab:

$ crontab -e

This command invokes the text editor that has been set for your system environment. The default editor for your system environment is defined in the EDITOR environment variable. If this variable has not been set, the crontab command uses the default editor, ed. To change the default editor:

$ which $EDITOR
$ 
$ EDITOR=emacs
$ export EDITOR

To do a backup everyday at 2am, add this line to the crontab:

00 02 * * * rsync -e ssh -av user@alstevens.org:/home/astevens/wiki.alstevens.org /pathto/wiki.alstevens.org