Install rdiff-backup in ubuntu
If you want to install rdiff-backup in ubuntu use the following command
sudo apt-get install rdiff-backup
Because rdiff-backup is using SSH, which asks for a password upon logging in, it will require human interaction during the actual back-up process. And because we are trying to setup an automated process, this is not what we want. Fortunately, this problem can be easily skipped by using SSH public keys. So, we'll need to create a pair of keys on the home computer, one of which will be saved on the work computer. Basically, these keys will tell the work machine that the home machine is allowed to login through SSH.first you need to make sure both machines installed with openssh.
Install openssh using the following command
sudo apt-get install openssh
Now you need to Generate a DSA key pair on the USA computer
ssh-keygen -t dsa
Hit enter when you are asked for the target directory and for the passphrase.
Send the public key to the UK computer:
(The UK computer has to have used the ssh client, otherwise, the .ssh directory won't exist)
scp .ssh/id_dsa.pub [email protected]:~/.ssh
Log in to UK PC and add the key to the list of authorized keys:
cat id_dsa.pub >> authorized_keys2
rm -rf id_dsa.pub
Test if everything is ok: Log out and log back in, this time, you shouldn't be asked for a password.
we want to do here is back-up the scripts/ directory on the UK PC to the USA PC. To do this, type the following command on the USA machine
rdiff-backup -v4 --print-statistics UK[email protected]:://home/UK-user/scripts/ scripts/
Automate Backup process with crontab
On the USA machine, type the following command to open the crontab editor
It will open vi.Once it started, Now, add the following line
15 1 * * * /usr/bin/rdiff-backup [email protected]:://home/UK-user/scripts/ scripts/
save and exit the file
As of now, every night at 1:15, the scripts directory from the UK PC will be saved to /home/USA-user/scripts directory and will be updated if any scripts are added to the work directory.