Don’t believe the hype: The cloud is far from safe. But fear not — now you can forget Dropbox once and for all and show the authorities a solid middle finger by deploying your own private , unlimited and safe cloud storage platform with Raspberry Pi and BitTorrent Sync.

Part of this process overlaps with the creation of Pi-based network storage, which which you can also check out. If you’re really adventurous, you can even create a Raspberry Pi Twitter Bot that adds in all the new files added to it. Do this.

BitTorrent? Isn’t that illegal?!

Well, actually, no. — although the most common use of the BitTorrent protocol is to distribute material that falls under copyright protection. BitTorrent Sync this is a separate (closed) project from the creators of BitTorrent; it uses the same basic file distribution principles, but with encryption and for a private group of users.

Simply put, 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 as it uses BitTorrent’s underlying peer-to-peer distribution technologies.

You will need

  • Raspberry Pi
  • USB stick
  • Computer for testing

Beginning

As always, I start with a fresh install of Raspbian, but this should work fine with an existing install. Grab an image from here and write it using this utility for OS X or ImageWriter for Windows. After logging in remotely via SSH perform a basic system update.

sudo apt-get update sudo apt-get upgrade 

Mount disk

List your drives using

 sudo fdisk -l 

FDISK-l

Once you have identified the correct device /dev for your drive:

 sudo mkdir /media/sync sudo mount -t auto /dev/sda1 /media/sync 

(provided that /dev/sda1 — your USB drive)

To make sure they are automatically mounted on restart, edit the config file fstab in the following way:

 sudo nano /etc/fstab 

Add the following line, remembering:

 /dev/sda1 /media/sync vfat defaults 0 0 
  • /dev/sda1/ should be where your USB stick is connected
  • /media/sync is the folder you created to act as a mount point
  • vfat is the file system type. Use ntfs-3g, if it’s an NTFS drive, but you also need to run sudo apt-get install ntfs-3g . For Linux partitions, ext4 is common.

Install BitTorrent Sync

Luckily, there is now an easy way to install without messy compilation, but we need to add our own source to find the package files. Use the following commands, pasting one after the other.

 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 

Please note that if you get file permission errors sources.list.d 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 

Start working with the update and installation commands as before.

After installing the package, you will be greeted by a special installation script. Create a «default instance» running on any random port number — I chose 55555.

pi-btsync-config

I ran the install and accepted the defaults for everything else (except for the password, obviously).

Check if BitTorrent Sync is working

The install script should have added it to the startup file, so try rebooting and verifying that:

 sudo shutdown -r now 

Give it a minute or so to restart your computer and then use another computer to browse its web interface, i.e. enter your Pi’s IP address, then colon and the web interface port selected during installation — by default 8888 ; so i typed http://192.1680.9:8888 . After logging in, you should welcome this.

btsync-start-screen

Create a folder pointing to a directory /media/sync or wherever you chose to mount the drive earlier. The secret passphrase is the key to all your files — never share it with anyone you don’t trust.

undercover sync passphrase

The application starts by indexing the disk if there are already files there, which may take some time.

synchronization indexing

In the meantime, you can safely go ahead and install the BitTorrent Sync app on other computers by choosing to paste your secret passphrase during the installation process. Select the appropriate directory to be used for local syncing and your files should be immediately pulled from the Pi and start syncing (if you have any files to start with — I used a data disk that already contains several hundred gigabytes of files) .

OSX file sync activity

On the tabs Story» displays a record of which files were added by which device. Transfers shows which files are currently being synced, up or down.

For advanced settings, click the cog icon next to the folder in the web interface where you can get the secret passphrase for access only for reading or generate one time passphrase, to avoid issuing a master key.

synchronization of connected devices

In practice, the Pi boots at around 600-700 kB/s, but I set a hard limit of 1 MB/s just in case. The initial sync will take a long time if you have terabytes of data — but remember that the more computers you have on your private BT Sync network, the faster subsequent syncs will be (similar to the «fill» principle for regular torrents),

Is it really safe?

Recent discoveries indicate that the NSA may have actually broken a large number of encryption schemes commonly used to secure services like VPNs, so what about BitTorrent Sync? Experts believe that the AES-256 encryption used there has not yet been cracked. Snowden himself said:

“Encryption works. Properly implemented strong cryptosystems are one of the few things you can rely on»

Can you consider using your personal Dropbox? Perhaps a family photo album that automatically syncs with everyone — BitTorrent Sync is ideal for large files, as can be the case with today’s cameras. Sending large photos via email is incredibly slow, but compressed photos are even more annoying! What will you use yours for?

Image Credit: adafruit/flickr, Kamil Porembi? ski/flickr

Похожие записи