BTsync on Fedora

Just a few quick notes on setting up the closed-source BitTorrent Sync (BTSync) for Fedora 19 Linux.

This configuration will allow for the launching of a separate instance of BTSync for multiple users and leverages the multi user capabilities of systemd on Fedora 19.

While my preference in handling my data is for open source products like rsync, it may turn out that none of them will find acceptance with my Windows users at home. Because of that I’m going to field test BTSync as a potential cross-plaform solution for backing up Windows user directories to our Fedora Linux backup server.

A 32-bit setup is available for Windows, while there are 32 and 64-bit binaries for Linux. The Linux binaries are tarred and gzipped and consist of a single file, btsync.

I unarchived btsync into /usr/local/bin on my Linux test machine. I then created a systemd init script, following this post in the Bittorrent user forum:

# /etc/systemd/system/btsync@.service
[Unit]
Description=BitTorrent Sync for %i

[Service]
Type=simple
User=%i
ExecStart=/usr/local/bin/btsync --nodaemon --config %h/.btsync/sync.conf
WorkingDirectory=%h

[Install]
WantedBy=multi-user.target

For each user that will be running BTSync (for now just the “backup” system user), I also created a configuration file, $HOME/.btsync/sync.conf (the ~/.btsync directory needs to be manually created, a sample sync.conf can be created by invoking “btsync — >sync.conf”):

# $HOME/.btsync/sync.conf
{
  "device_name": "zeus",
  "listening_port" : 0,     // 0 - randomize port
  "storage_path" : "/home/backup/.btsync",
  "check_for_updates" : true,
  "use_upnp" : true,       // use UPnP for port mapping
  "download_limit" : 0,
  "upload_limit" : 0,
  "webui" :
  {
    "listen" : "0.0.0.0:8888",
    "login" : "backup",
    "password" : "noneshallpass"
  }
}

Remember to change the listen port for the web ui to something unique if enabling multiple users on a system. For greater security you may also want to specify 127.0.0.1 as the host IP in the listen directive (e.g. “listen” : “127.0.0.1:8889”).

Enable the service by issuing a

systemctl enable btsync@backup.service

(substituting the real user name for “backup”)

and then start it with

systemctl start btsync@backup.service

Use

systemctl status btsync@backup.service

to check for errors. The btsync console should now be available at the url http://localhost:8888 (or whatever host and port specified in your configuration).

POSTSCRIPT: Uninstalling BTSync

All good things must come to an end, of course. So too did my testing of BTSync. Removing it would have been much easier if I’d just thought things through before I started. The main thing to remember is that as a multi-user targeted service, you should to disable it in systemd on a per user basis before ripping out your config and the binary.

So…

systemctl stop btsync@backup

systemctl disable btsync@backup

After doing this for each user you should then whack the ~/.btsync configuration directory in each user’s home and then delete the btsync@.service under /etc/systemd/system, and btsync under /usr/local/bin.

This entry was posted in System Administration on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).