Remote backup with dump and ssh

Install dependences
If you have not installed then see Dump-backup how to do it.

Create and configure local user to backup and ssh keys
Make sure that you set a password, this password will protect the ssh-key stored on your disk, you will need it later! For more on ssh keys see SSH.

Configure the user permissions
Give the user permission to read the local directory where the backup files will be stored before to be sent:

Forward the mails to root (only if you have a mail server installed):

Start the ssh-agent
This script should be executed once time per boot. Download it here.

This will ask the password to decryptograph the ssh key.

Create the backup and copy scripts
You have to use one generic configuration file (like this backup-generic), and one specific script for each backup partition and level (like this backup-home-level-0.sh). Edit them to fit your needs.

Example of generic configuration file
You should change this lines:


 * AGENTINFO: should match with start-agent.sh edited above.


 * SERVER: username and host that will store the backup.


 * REMOTEDIR: directory at the SERVER that the backup will be remotely stored.


 * LOCALDIR: local directory where the backups are stored.

Examples of backup scripts
This make a backup level 0 of /home partition to /scratch/dump-backups dir:

This make a backup level 1 of /usr partition to /scratch/dump-backups dir:

Configure sudo
For more informations look Sudo.home/user2

Edit the sudoers file with visudo command:

Create and configure remote user to store the backup
If you didn't do it, copy the content of the file /home/user/.ssh/id_dsa.pub to the file /home/user2/.ssh/authorized_keys of the server where the backup will be stored. Add this to the beginning of the line of the authorized_keys file: no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty

And set the correct permissions:

Optional: Non root access
If you want to see the backup files without using root or the user backup you should change the group ownership of the backup dir, for example to jonh user:

Configure cron
For more about cron see Cron.

Add backup user to cron group:

Create a file to maintain your cron like /home/user/backup.cron:

Install the user crontab: