some backup links using rsync

https://github.com/elkarbackup/elkarbackup

ElkarBackup is a free open-source backup solution based on RSync/RSnapshot

Automated Rsync Backup

 

Here’s how to setup an automated backup process using Rsync.

1. Test rysnc using a password. Here we will be copying files from /src-dir to /dest-dir on [email protected]

1
> rsync -rvz -e 'ssh -p 22' --progress /src-dir [email protected]:/dest-dir

2. Now let’s automate Rsync. Create the public and private keys on the source machine.

1
 > ssh-keygen

3. Copy the public key to username’s ~/.ssh/authorized_keys file in the destination machine.

1
 > ssh-copy-id "[email protected] -p 22"

4. Test SSH using key authentication.

1
> ssh "[email protected] -p 22"

5. Test Rsync using key authentication.

1
> rsync -rvz -e 'ssh -p 22' --progress /src-dir [email protected]:/dest-dir

6. Add Rsync to daily cron.

1
2
3
> cd /etc/cron.daily/
> echo 'rsync -rz -e "ssh -p 22" /src-dir [email protected]:/dest-dir' >> rsync.cron
> chmod u+x rsync.cron

7. In case you want to use a password instead (not recommended), you can use sshpass.

1
> rsync -rvz -e 'sshpass -p password ssh -l username -p 22' --progress /src-dir [email protected]:/dest-dir

 

Leave a Reply