BitTorrent Sync

Tutorial – How to set up BitTorrent Sync on a Linux server to create a Dropbox-like syncing solution


Update (August 28th, 2013) : The iOS BT Sync app is now available for download. Try it out!

BitTorrent Sync (BTSync) is a “Private Dropbox” of sorts in that it offers the same functionality (syncing your files across devices) but without going through a third-party’s servers. Mac and Windows clients are available for download and have some nifty features such as one-time share keys and read-only syncing options. The advantage of BTSync is better handling of large files (especially if you sync across multiple devices) and you don’t have your files hosted on someone else’s server(s).

The advantage of Dropbox is that should you lose all your machines that were syncing to Dropbox, you would still have a copy in the Cloud that you would be able to download on a new machine. This is undoubtedly BTSync’s biggest disadvantage if you don’t have at least two machines on all the time. If, however, you have a server, you can set up BTSync on that server thus creating your own “always-on” sync machine that will create a copy of the files you wish to sync immediately. Let’s get started…

Assumptions: This tutorial does not aim to teach you how to use the BTSync Mac/Windows clients. For the rest of the tutorial, I recommend creating a test folder on your computer, generating a BTSync key for that folder, and then adding that key to the new BTSync instance you’re about to create on your Linux-based server.

Requirements: This tutorial assumes you have a Linux-based server. It does not have to be a dedicated server but you do need to have enough rights to download and install stuff.

Step 1 – Download the right version

Download the Linux BTSync version that is appropriate for your server here. You’ll notice that there are several versions available:

BitTorrent Sync Linux Download Options
BitTorrent Sync Linux Download Options

If you’re not sure which one is for you, print out your system information using this command:

uname --all


uname -p to get your processor.

These commands will output something like:

Linux 2.1.32-042stab076.5 #1 SMP Mon Mar 18 20:41:34 MSK 2013 x86_64 x86_64 x86_64 GNU/Linux


For the above output, I downloaded the Linux_x64 version. From the server:

cd /tmp
mkdir btsync
cd btsync
wget .

Step 2 – Install BitTorrent Sync

Ready? It’s as easy as 1-2-3:

tar -xvzf btsync_x64.tar.gz

This will extract btsync which is the executable. Since we’re still in /tmp, now’s a good time to move the btsync executable somewhere safer. I chose to create a folder at the root level “/BTSync”:

mkdir /BTSync
mv /tmp/btsync/btsync /BTSync

Note that by default, the files that will later be synced to your server will be located in a folder called .sync which will be located in the same folder where btsync runs. Later on, we’ll take a look at some configuration options that can help you modify this behavior.

You’re done. To start BTSync, run:


At this point, you should be able to point your web browser to port 8888 on your server and you will see the BTSync GUI (http://youripaddress:8888).


From here, you can easily sync folders with your server as you normally would by simply adding the shared secret keys that you have set up on your PC. The GUI is simple and easy to use. Though everything “just works” now, I did not want to keep the default port (8888) and password settings that come installed with the GUI. Let’s change that…

Step 3 – Set up a password, change the port (optional)

BTSync allows you to configure some settings, including a password to protect the GUI. To create a configuration file, create a btsync.conf file in the same folder where the btsync executable is located. In my example, that would be in /BTSync. If you want to get an example configuration file, you can execute:

./btsync --dump-sample-config

For convenience’s sake, I’ve made one available for download here.

To set a username/password, create or edit the config file, btsync.config and edit these lines with whatever values make sense for you:

“webui” :
“listen” : ““,

Replace the bold values by whatever is convenient for you. When you’re done, you’ll need to restart the BTSync server and pass the configuration file as a parameter. To do so, kill the btsync process that you started earlier and restart it using ./btsync --config btsync.config. To get the process ID, simply try to start the btsync process; if it is already running, it will print out its PID:

./btsync --config btsync.config
Can't lock pid file. It seems BitTorrent Sync is already running with pid 1857
kill -9 1857
./btsync --config btsync.config

Update: As pointed out by Arnaud in the comments, you could also just use killall btsync.

BTSync Authentication

Now, when you close and re-open the GUI, you should get a password prompt.

For more information about BitTorrent Sync and the different configuration options available, visit the official website. To download BitTorrent Sync for Windows or OSX, click here.


I’m a big fan of DropBox and I’m happy to see similar services popping up. For most users, I’d say these services have an amazing offer, are easy to use, and are relatively cheap if not free – so if it works for you, stick to them! For power users, or for users who have lots of data they want to sync across several machines, BTSync provides a few advantages at the cost of some user friendliness (for now) and a more complex set up process. By setting up BTSync on a server with very high availability, you eliminate BTSync’s weakest point by allowing for a copy of your synced file(s) to be created almost immediately. You gain the privacy of your own server but you must also keep in mind that your sync capacity and reliability is entirely your responsibility. Finally, if you need to sync very large files, BTSync’s technology is the way to go. (You can read more about the technology used here.) At time of writing, it seems that mobile versions of BTSync are also being developed making BTSync a very powerful all-round syncing solution.

360 thoughts on “Tutorial – How to set up BitTorrent Sync on a Linux server to create a Dropbox-like syncing solution”

  1. Questions
    1: does btsync need to be running on only one machinf or every machine that needs to sync?
    2. how does btsync handle nonstatic ip addresses?
    3. I have a home office and a work office. I want to sync both of them to my remote webserver hosted by a third party. Can I do that?
    4. Both work & home have freenas servers for data and are mounted with fstab. Can I sync the mounted directories just like the local directories?

    Your article was good and not too technical. it could have used more high level information

    1. Hi Kirk,

      1/ BTSync needs to be running on every machine that needs to sync.
      2/ BTSync uses Bittorrent technology that is inherently peer-to-peer and IP-independent. I won’t go into details but it basically doesn’t need a fixed IP; it only needs an address that is represented by the shared URL that BTSync creates.
      3/ Yes, that is exactly the scenario that I’m in and why I wrote this. In this case, your server acts as the “man-in-the-middle” that will always have the latest sync so that when you go back home or move to your office, when you turn on that machine, it will sync from the server thus guaranteeing that you have the latest version of the files you were working on from your other office.
      4/ As long as you can point to them from the BTSync client app, you can sync them.

      I tried to keep it simple as much as possible but if there’s more technical stuff you’d like to see, let me know, I’ll be glad to expand.

  2. By adding more servers syncing the same content does that increase the speed of the synchronization? Just like it works for traditional torrents.
    I want to sync 40GB of small files between 2 servers in different continents, if add more servers will this speed things up?

    1. If the servers have more upload bandwith then they should increase the speed. The API has a function to get a third key that will only allow you to downlaod the encrypted version, that way you could use less trustable hosts to increase bandwith and redundancy. Unfortunatly the API is reserved for developers…

  3. This is wonderful. Never done anything like this on a server before, yet it worked out fine. Bit of trouble on the listening port; turned out to be a hosting issue.

    Migrated from Dropbox. Thank you!

  4. Thanks for your tutorial :)

    2 little things :
    – you can also kill the process through his name -> “killall btsync”
    – a typo here “To do so, kill the btsync process that you started earlier and restart it using ./btysnc –config btsync.config.” should be “./btsync –config btsync.config”

    Thanks again.

  5. Hi, i follow this tutorial and sincronize the machines, but where i can find the files in client machine?

    my english is not good, sorry ‘-‘

  6. Hey, Thanks for the tutorial; I have it set up an running. My only concern is that the password protected ui still runs on an http page and the password is delivered unencrypted. Is there any easy way to tell bittorrent sync to listen on an https page instead of http?

    1. Hello Petra,
      I have not tried setting this up over HTTPS so I’m not sure but I don’t see what would prevent you from setting up a dedicated HTTPS port and keeping everything else the same, assuming you have the right certificates. Like I said, I haven’t tried this myself so I’m not 100% sure but if I do find anything conclusive, I’ll reply here.

    2. You can always setup a reverse proxy using apache or any other webserver, and make it available on https only.
      This way, you completely ostracize the btsync gui from the web.

    3. I prefer to have the web service only listen on (localhost), not open the firewall to 8888, and instead use an SSH tunnel to forward the port to my desktop. Once it’s set up, you don’t need to use the web interface on the server very often.

      From your desktop:
      ssh -L 9999::8888

      Now http://localhost:9999 on your desktop is connecting to your server’s port 8888 through a secure SSH tunnel.

      If you have to use Windows, Putty can do the same thing.

      1. I’d like to know if two instances of BTSync in different networks can be interconnected via an SSH tunnel, i.e. I don’t want my files floating through the Internet, just between my machines. Any ideas?

  7. Hello.

    Is there anyway to get notified when a folder is synced against certain host via the CLI? On the Windows GUI, I can monitor “Status” column under Devices tab. Could btsync write a file like .synced.device_name or such and remove this file while files are synced?

  8. Hi!

    I’m currently stuck at the end of step 2…

    I have downloaded the archlinux version and extracted the tar.gz (using a GoFlex Home NAS)

    I moved it to /media/BTSync

    When I try to run it, it returns an error. Here is a copy/paste:

    [root@Cloud btsync]# systemctl start btsync
    Failed to issue method call: Unit btsync.service failed to load: No such file or directory.
    [root@Cloud btsync]# cd /media/BTSync
    [root@Cloud BTSync]# ./btsync
    -bash: ./btsync: Is a directory
    [root@Cloud BTSync]# systemctl start ./btsync
    Failed to issue method call: Unit .-btsync.service failed to load: No such file or directory.
    [root@Cloud BTSync]# systemctl start btsync
    Failed to issue method call: Unit btsync.service failed to load: No such file or directory.
    [root@Cloud BTSync]# cd /btsync
    -bash: cd: /btsync: No such file or directory
    [root@Cloud BTSync]# cd /media/BTsync/btsync
    -bash: cd: /media/BTsync/btsync: No such file or directory
    [root@Cloud BTSync]# ls
    [root@Cloud BTSync]# cd btsync
    [root@Cloud btsync]# systemctl start btsync
    Failed to issue method call: Unit btsync.service failed to load: No such file or directory.
    [root@Cloud btsync]# ls
    btsync.install btsync.service btsync@.service PKGBUILD
    [root@Cloud btsync]#

    Any help is much appreciated!

    1. The Bittorrent Infrastructure serves as a relay or intermediary (depends) to locate machines and sync files. You can probably find more information on the official Bittorrent Sync website and in the forums.

  9. Hi Great tutorial thanks! I’m a relative newbie when it comes to Linux, so bear with me! I’m having a few issues setting this up on my VPS. Bittorrent Sync is installed on my VPS and I can access it via HTTP no worries I now just need to secure it using btsync.config. when I go to restart the service I get the error: Error while parsing config file: lexical error: invalid char in json text: 8:8888″, “login”: “superadmin”, “pa (right here) ———-^.

    Any help would be greatly appreciated

    1. Hi,

      It’s hard to help you without the entire configuration but one thing I notice is that the double quotes are not the same across your string… this might just be due to copy/paste in this blog but perhaps you’re trying to paste a character that is invalid. Make sure that you are not using any special characters – double quotes can be represented in many different formats, some of which are not valid for JSON. To be safe, try using a simple text editor and save your config file as a .txt. Then, copy/paste from that instead.

      It might be something else entirely in which case I’d need to see more of your config file around those lines.

      PS: To make sure your JSON is valid, I recommend pasting your config file on

Leave a Reply to Ravi Talari Cancel reply