What you want to do: create and maintain an incremental backup some data on /copy/from/here on a local computer to /copy/to/here on a remote computer, transmitting the backup securely, efficiently and periodically, without any user intervention.
How to do it:
1) Test rsync from the command line
2) Enable password-less logins over SSH
3) Tell cron to periodically execute this task
Step 1: Test rsync from the command line
From your local computer, try
rsync —verbose -r -u /copy/from/here/ remoteuser@remotecomputer.org:~/copy/to/here/
It will ask you to authenticate on the remote computer. Once you do so, rsync should copy everything from /copy/from/here to /copy/to/here on remotecomputer
If this doesn’t work, there is something wrong with your SSH connection, or with your installation of rsync.
Step 2: Enable password-less logins over SSH
From localcomputer, try
localuser@localcomputer$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (~/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Press enter key]
Your identification has been saved in ~/.ssh/id_rsa.
Your public key has been saved in ~/.ssh/id_rsa.pub.
The key fingerprint is:
33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 localuser@localcomputer
You’ve just made yourself a RSA key. Copy the public key to the remote computer and put it in .ssh/authorized_keys on remote computer.
That’s it. Try SSHing to remotecomputer from localcomputer. You should be able to log in without entering a password. If this worries you, try logging in from a different computer. It should prompt you for authorisation then.
Step 3: Automate backups
Add the rsync command to your crontab file. If you run Mac OS X, you can use Cronnix, which is a thin GUI around crontab to make editing it easier.