Don’t believe the hype: the Cloud is far from secure. But have no fear – now you can forget Dropbox once and for all, and show the authorities a solid middle finger by rolling your own private, unlimited, and secure cloud storage platform with a Raspberry Pi and BitTorrent Sync.
Part of this process overlaps with making a Pi-based Network Attached Storage, which you might also want to check out. If you’re really adventurous, you could even build a Raspberry Pi Twitter Bot that tweets out all the new files added to it. Do it.
BitTorrent? Isn’t That Illegal?!
Well, actually, no – though the most common usage of the BitTorrent protocol is distributing material that falls under copyright protection. BitTorrent Sync is a separate (closed source) project from the creators of BitTorrent; it uses the same underlying file distribution principles, but with encryption and for a private group of users.
In simple terms, BitTorrent Sync is similar to Dropbox in that it syncs files and folders between authorized computers, but doesn’t require a third party cloud provider since it uses the underlying peer-to-peer distribution technologies of BitTorrent.
You Will Need
- Raspberry Pi
- USB storage drive
- Computer for testing
Like always, I’m starting from a fresh Raspbian installation, but this should work fine with an existing installation. Grab the image from here and burn using this utility for OS X or ImageWriter for Windows. After logging in remotely through SSH, perform a basic system update.
sudo apt-get update sudo apt-get upgrade
Mount Your Drive
List your drives using
sudo fdisk -l
Once you’ve identified the correct /dev device for your drive:
sudo mkdir /media/sync sudo mount -t auto /dev/sda1 /media/sync
(assuming /dev/sda1 is your USB drive)
To ensure these are auto-mounted on restart, edit the fstab configuration file as follows:
sudo nano /etc/fstab
Add the following line, remembering:
/dev/sda1 /media/sync vfat defaults 0 0
- /dev/sda1/ should be wherever your USB drive gets mounted
- /media/sync is the folder you created to act as a mount point
- vfat is the type of filesystem. Use ntfs-3g if it’s an NTFS drive, but you’ll need to also run sudo apt-get install ntfs-3g. For Linux partitions, ext4 is common.
Install BitTorrent Sync
Luckily, there’s now an easy way to install without messy compiling – but we do need to add a custom source to find the package files. Use the following commands, pasting one by one.
sudo gpg –keyserver pgp.mit.edu –recv-keys 6BF18B15 sudo gpg –armor –export 6BF18B15 | sudo apt-key add - sudo echo deb http://debian.yeasoft.net/btsync wheezy main contrib non-free >> /etc/apt/sources.list.d/btsync.list sudo echo deb-src http://debian.yeasoft.net/btsync wheezy main contrib non-free >> /etc/apt/sources.list.d/btsync.list sudo apt-get update sudo apt-get install btsync
Note that if you get permission errors on the sources.list.d file, try editing the file manually with Nano:
sudo nano /etc/apt/sources.list.d/btsync.list
and paste in these lines.
deb http://debian.yeasoft.net/btsync wheezy main contrib non-free deb-src http://debian.yeasoft.net/btsync wheezy main contrib non-free
The go ahead with the update and install commands as before.
Upon installing the package, you’ll be greeted with a special installation script. Create a “default instance” operating on any random port number – I chose 55555.
I ran through the installation and accepted the defaults for everything else (except for password, obviously).
Check If BitTorrent Sync Is Working
The installation script should have added it to the startup file, so go ahead and restart to check this:
sudo shutdown -r now
Give it a minute or so to restart, then user another PC to browse its web interface – that is, type the IP address of your Pi, followed by a colon, and the web interface port chosen during setup – the default being 8888; so I typed http://192.1680.9:8888 . After logging in, you should be greeted with this.
Create a folder pointing to your /media/sync directory or wherever you chose to mount the drive earlier. The secret passphrase is the key to all your files – never give it out to anyone you don’t trust.
The app begins by indexing the drive is there’s already files there, which may take a while.
In the meantime, you can safely go ahead and install the BitTorrent Sync application onto your other machines, choosing to paste in your secret passphrase during the setup process. Choose the relevant directory to be used to sync locally, and your files should immediately be pulled across from the Pi and begin syncing (if you had any there to begin with – I used a data drive already containing a few hundred gigabytes of files).
The History tabs shows a record of what files have been added by which device. Transfers shows which files are currently being synced, either up or down.
For advanced setups, click the cog icon next to the folder in the web GUI, where you’ll be able to grab a secret passphrase for read-only access, or generate a one-time passphrase to avoid giving out the master key.
In practice, the Pi uploads at about 600-700 kB/s, but I set a hard limit of 1 MB/s just in case. The initial sync is going to take a long time if you have terabytes of data – but remember, the more computers you have in your private BT Sync network, the faster subsequent syncs will be (the same as “seeding” principles for regular torrents).
Is It Really Secure?
Latest revelations show that the NSA may in fact have broken a large number of encryption schemes commonly used to secure services such as VPNs, so how about BitTorrent Sync? Experts believe the AES-256 encryption used there has yet to be cracked. Snowden himself said:
“Encryption works. Properly implemented strong crypto systems are one of the few things that you can rely on”
Can you think of a use for your own private Dropbox? Perhaps a family photo album that automatically syncs to everyone – BitTorrent Sync is ideal for large files as can be the case with modern cameras. Sending large photos over email is infuriatingly slow, but I find compressed photos even more annoying! What will you use yours for?