February 2008 I stumbled across a webserver provider that provide quite a lot
of space for a very small amount of money. You get (among other things) the following things for
under 7$ a month:
- 1.5 terabyte of space (1500 gigabyte)
- 15 terabyte of data transfer per month
- SSH/FTP/SFTP-access
- For webhosting almost anything you can imagine:
PHP, CGI, MySQL, PostgreSQL, Ruby, Perl, Shopping cart, Frontpage extensions and so on
- Unlimited domains hosted
- 2500 mail accounts (POP/IMAP) with two different web mail solutions
- Email auto-forwarder and auto-responder
- Spam-protection for email
- Full access to f.ex. .htacces and so on
- Log-files/web statistics
- Tons of hosted web applications like Forums, guestbooks, web-blogs, mailinglists, poll and survey, wiki,
wiki, Mambo/Joomla and so on
- Supports streaming video, audio, flash, shockwave
- All hosted on fast internet lines and servers with UPS, Diesel generator
All in all a good deal. But we are just getting to the good part. Did you notice you get 1.5 terabyte of
storage, and SSH-access? This means you can use it as a mapped drive on your linux/BSD-machine.
All you need to do, is install SSHFS, and you can mount your storage at Bluehost on your machine, and
access it as if it was another disk-drive. Of course it will be slower, depending on your internet
connection, but ideal for backup in my opinion.
If you're a bit paranoid like me, you don't want to risk them (bluehost site admins) getting access to your
files, and then you can use encfs on top of sshfs. Encfs is a great tool that makes all the files
encrypted, you just use it as a normal folder. First a link to how to install sshfs/encfs on linux:
Secure Encrypted Remote Volume Howto
Now, a bit of info on how to do it on FreeBSD (assuming you have signed up for an account
on Bluehost:
- cd /usr/ports/sysutils/fusefs-sshfs/
- make install
- cd /usr/ports/sysutils/fusefs-encfs/
- make install
- Make sure you're in the operator group (type groups), if you're not, add yourself to /etc/groups on the
operator line.
- (as root): chown root:operator /dev/fuse*
- (as root): chmod 0660 /dev/fuse*
- (as root): sysctl vfs.usermount=1
- mkdir ~/bluehost
- mkdir ~/bluehost/ssh
- mkdir ~/bluehost/enc
- (on bluehost): mkdir enc
Now, you're ready to mount your
Bluehost-drive, this can be put into
a script if you want:-
sshfs -o idmap=user,workaround=rename yourusername_at_bluehost@your_bluehost_ip_or_domain:enc ~/bluehost/ssh
- encfs ~/bluehost/ssh ~/bluehost/enc
Notice that the first time you need to provide what kind of
encryption you want. You might get some trouble if choosing paranoid, therefore I chose standard (
just press enter at the prompt). This will first mount up your space at
Bluehost into ~/bluehost/ssh,
then encrypt it with encfs, accessed through ~/bluehost/enc.
You can now use ~/enc/ as a normal folder, but it is really encrypted at
Bluehost in the enc-folder you made there.
Try making a file in ~/bluehost/enc, putting some text in it, and then log onto your bluehost account and
see how it looks. All garbled. Be sure to keep your password safe, since it will not be possible
to access the files without the password. Also, encfs keeps a file in the root of your encrypted
filesystem (~/enc/.encfs5 on bluehost). This file is also key to accessing the files...
To unmount it, just type - umount ~/bluehost/enc
- umount ~/bluehost/ssh
.
Now, if that wasn't enough, we can go on :) You might want to backup your files, I use
rdiff-backup to do it. I will explain how to get started on that as well.
- cd /usr/ports/sysutils/rdiff-backup/
- make install
Now, I will take an example if you want to backup your /etc and /usr/local/etc folders. This means
you might want to mount up your folder on bluehost as root instead though. Use the same procedure,
just do it as root. Exchange ~ with ~your_username. First, make two folders on your
Bluehost-drive to keep the two
backups in:
- mkdir ~yourusername/bluehost/enc/etc
- mkdir ~yourusername/bluehost/enc/usr-local-etc
Now, we go on to start rdiff-backup:
- (as root): rdiff-backup /etc ~yourusername/bluehost/enc/etc
- (as root): rdiff-backup /usr/local/etc ~yourusername/bluehost/enc/usr-local-etc
You will get some error about hardlinking, since that doesn't work over sshfs, but rdiff-backup
will take care of this for you, so when you restore it the links will be correct.
NB: You might want to run the commands in a screen, since depending on your bandwith and cpu (for
compression/encryption), this might take some time. I use rdiff-backup because it is quick,
only replicate changes, and it keeps old files around if you need to restore an old copy. And with
1.5 terabyte for under 7$ a month, why not keep them around :).
Here is a bit more info
on using rdiff-backup to backup files to a sshfs-filesystem.
<Shameless plug> If you want to sign up for an account on
Bluehost, please use my link, since
it will give me a 65$ finder's fee :)
I hope this was useful to you, and if you're completely
stuck or have questions, please send me a note on
bluehost_question@mortencb.cx.
|