Rsync and SSH
From GreyWiki
We like the idea of using Rsync and SSH to mirror the backups directory. Here's the basic run-down of how it can be done:
Create the identity file using ssh-keygen -t dsa. This will create two files in the ~/.ssh directory. It will prompt for a passphrase (twice), but enter an empty one (just press Return), since the whole purpose of this exercise is to remove the necessity of entering a passphrase.
Copy the .pub file to ~/.ssh/authorized_keys. If you already have an authorized_keys file, just append identity.pub to it (i.e. cat id_dsa.pub >> authorized_keys). SCP the identity file (i.e. id_dsa) to the machine that will be pulling the files, and name it accordingly.
The cron job will look something like this:
* 7 * * * rsync -avz --delete -e "ssh -i /home/user/.ssh/mirror-rsync-key" user@site:/var/www/ /var/www/
Not too shabby, eh?
