From it’s man page, rsync is a program that behaves in much the same way that rcp does, but has many more options and uses the rsync remote-update protocol to greatly speed up file transfers when the destination file is being updated.
The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network connection, using an efficient checksum-search algorithm described in the technical report that accompanies this package.
Say 192.168.1.10 (anduril) is the backup destination , herugrim is the host’s hostname, the following step will automatically rsync the home directory to the backup server.
user@herugrim ~ $ ssh-keygen -t rsa -C firstname.lastname@example.org Generating public/private rsa key pair. Enter file in which to save the key (/home/user/.ssh/id_rsa): /home/user/.ssh/id_rsa.192.168.1.10 Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/user/.ssh/id_rsa.192.168.1.10. Your public key has been saved in /home/user/.ssh/id_rsa.192.168.1.10.pub. The key fingerprint is: 11:d9:23:2e:68:05:59:d9:ac:5a:00:69:17:3a:b4:24
user@herugrim ~ $ ssh-copy-id -i .ssh/id_rsa.192.168.1.10.pub email@example.com
user@herugrim ~ $ ssh firstname.lastname@example.org -i .ssh/id_rsa.192.168.1.10 user@anduril:~$
user@anduril:~$ mkdir backup/herugrim -p
user@herugrim ~ $ rsync --verbose --progress --compress --rsh=ssh --recursive --times --perms --links --delete /home/user anduril:/home/user/backup/herugrim -e "ssh -i /home/user/.ssh/id_rsa.192.168.1.10"
30 1 * * * rsync --compress --rsh=ssh --recursive --times --perms --links --delete /home/user anduril:/home/user/backup/herugrim -e "ssh -i /home/user/.ssh/id_rsa.192.168.1.10"
sudo /etc/init.d/cron start #depending on your linux distro