This tutorial will cover how to set up a simple backup job between two machines using rsync and ssh. You will need HOST A and HOST B, whereby HOST B is your target backup service.
On HOST B:
This will output something like:
Copy and paste this into ~/.ssh/authorized_keys on HOST A.
Now the following should log in without prompting for a password or user input:
Assuming this works, great!
Now on HOST B:
The options used are explained as follows:
-a ‘archive mode’ (Keep uid,gid,permissions,etc)
-z compress transfer if possible
-u only updated files
Now in this case, HOST B connects to HOST A and pulls off the relevant data. You can just as easily run things the opposite way round, and have HOST A connect to and put it’s data onto HOST B, however assuming HOST B is your backup service, you may prefer to have the backup service go out and get the backups rather than giving other hosts a login/shell to your backup service.
Tags: archive, automated backup, automatic backup, backup, public key, rsync, ssh, ssh key, ssh public key