Using scp and duplicity for full security back up
To be almost 100% that your data is secure, and I said almost because you are never 100% secure!
Ok, Here we will see how to use together ssh (scp) and duplicity to encrypt your backed up data and to copy it to another server using an encrypted tunnel.
Pre-requisites
Your will need:
- gpg
- duplicity
- ssh keys on the backing server http://linux.go2linux.org/node/16
Installing the software
This is tested on Debian and Ubuntu, but should be distro independent
To install duplicity run:
apt-get duplicity
Generating the key
To generate the key you will use for encrypt your backup run:
gpg --gen-key
Enter all the info it asks, and the passphrase, (Do not forget the passphrase or you will never be able to recover your data)
Backup your files to another server
In this example I will back up my home directory into a second server
First we need to see the available keys
gpg --list-key
This could be the output
pub 1024D/87819492 2007-03-18
uid Name Last_Name (Comment)
sub 2048g/2DBF4EB5 2007-03-18
Now export the passphrase to an enviroment variable
export PASSPHRASE=your_passphrase
and run the command to backup
duplicity --encrypt-key "87819492" --sign-key "87819492" /home/user/ scp://user@other.server//home/user/backup/
Restore the backup
duplicity --encrypt-key "87819492" --sign-key "87819492" scp://user@other.server//home/user/backup/ /home/user/
You are done, all your back is secured.
Do not forget the passphrase
Trackback URL for this post:
If you like this article, subscribe to our full rss
Please post your question in our forum and use comments only to leave your comments about the article, thanks.













Post new comment