Howto: Free Encrypted Online Storage for Ubuntu
For quite a while now I was looking for a solution, to store a backup of my boot partition (ubuntu server) online, since it took me about half a year to get the system configured the way I wanted it. Loosing it would definitely cause an attempted genocide. But I had two major concerns:
1: The costs. Why would I have to pay for something, that is already available in different forms. Yeah, services like S3 from amazon are affordable, but, why pay when you don't have to, right?
2: Security. I'm aware of the fact that there is no such thing as total security when you're somehow connected to the interwebs, but I don't wanna trust some firm, where I can't hunt down the sysadmin with a baseball bat, because he got into my backup files. I think you get the point.
So here is what I did.
Create a backup with tar, split it into 94MB files, encrypt them with my gpg key and upload them to rapidshare. Rapidshare will delete the files after 3 month, if you haven't accessed them, which sould be quite enough.
Let's have a look at the full backup script:#!/bin/bash
#create directory for this month full back in /home/saylar/backup/
mkdir /home/saylar/backup/`date '+%Y-%m'`
mkdir /home/saylar/backup/`date '+%Y-%m'`/full_backup/
#create a full backup for this month and split it into 94MB Files
tar cvj --listed-incremental /home/saylar/backup/`date '+%Y-%m'`/fullbackup.snar --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys --exclude=/home/saylar/backup / | split -d -b 90m - /home/saylar/backup/`date '+%Y-%m'`/full_backup/full_backup.tar.bz2.split
#encrypt the files with gpg
gpg --encrypt-files --batch --no-tty -r dummy@email.address /home/saylar/backup/`date '+%Y-%m'`/full_backup/*split*
#upload the files via rsupload script
for gpg in /home/saylar/backup/`date '+%Y-%m'`/full_backup/*gpg;
do /home/saylar/backup/rsupload.pl "$gpg";
done
#now move the file with Rapidsharelinks into corresponding directory
mv /home/saylar/backup/rsulres.txt /home/saylar/backup/`date '+%Y-%m'`/full_backup/
#delete gpg files after they were succesfully uploaded
rm -r /home/saylar/backup/`date '+%Y-%m'`/full_backup/*gpg
So, if you wanna do that, you have to do the following things:mkdir ~/backup
mkdir ~/backup/log
chmod a+x scriptname
sudo crontab -e
0 6 1 * * /home/saylar/backup/backup_full >> /home/saylar/backup/log/backup_full.log 2>&1
0 6 8,15,23,30 * * /home/saylar/backup/backup_incr_weekly >> /home/saylar/backup/log/backup_incr_weekly.log 2>&1
0 6 2,3,4,5,6,7,9,10,11,12,13,14,16,17,18,19,20,21,22,24,25,26,27,28,29,31 * * /home/saylar/backup/backup_incr_daily >> /home/saylar/backup/log/backup_incr_daily.log 2>&1
30 23 * * * /home/saylar/backup/mvlog > /dev/null
PS: I'm no programmer at all, so I know that some things could be done much nicer, but it works very well for me. If you have any suggestions, let me you know and I'll be happy to change it.
Sources:
Howto: Backup and restore your system!
Rapidshare Upload Script
GPG Tutorial
Download Backup script Here