Skip to main content

Install BitTorrent Sync on Ubuntu 16.04 from Official Deb Repository

BitTorrent Sync

BitTorrent Sync, aka btsync, is a very convenient tool for file sharing and syncing, released by BitTorrent. Inc, the same company that invented the BitTorrent protocol. I like it because it helps me back up my Web site effortlessly.

It can run on Linux, Windows, Mac, Android, iOS, Windows Phone, Amazon Kindle Fire and BSD. In this article, I’m going to share with you how to install BitTorrent Sync on Ubuntu 16.04 LTS from its official deb repository.

Install BitTorrent Sync on Ubuntu 16.04 LTS

Open sources.list file with nano text editor or vi text editor in the terminal.

sudo nano /etc/apt/sources.list

Append the following APT line at the end of this file.

deb btsync non-free

Save and close this file.

In order for APT to authenticate packages from the above repository, we need to import BitTorrent Sync’s public key. First download the public key with wget.


Import the key with apt-key.

sudo apt-key add key.asc

Now let’s update local package index and install BitTorrent Sync

sudo apt update

sudo apt install btsync

Managing BitTorrent Sync

To start BitTorrent Sync, use systemctl

sudo systemctl start btsync

Enable BitTorrent Sync to auto start when Ubuntu 16.04 is booted up.

sudo systemctl enable btsync

Check its status.

systemctl status btsync


● btsync.service - BitTorrent Sync service
  Loaded: loaded (/lib/systemd/system/btsync.service; enabled; vendor preset: e
  Active: active (running) since 六 2016-05-21 09:15:19 CST; 1min 26s ago
Main PID: 6406 (btsync)
  CGroup: /system.slice/btsync.service
  └─6406 /usr/bin/btsync --config /etc/btsync/config.json

5月 21 09:15:19 xenial systemd[1]: Starting BitTorrent Sync service...
5月 21 09:15:19 xenial systemd[1]: Started BitTorrent Sync service.

As you can see from the output, btsync service is successfully enabled and it’s running. By default, it’s running as btsync user. You can check this out with:

sudo apt install htop


And then Press F4, search for btsync.

linuxbabe@xenial: ~_021

The configuration file of btsync is located at /etc/btsync/config.json. Here’s the default configuration.

  "listening_port" : 0,
    "storage_path" : "/var/lib/btsync/",
        "pid_file" : "/var/run/btsync/",
    "agree_to_EULA": "yes",

  "webui" :
    "listen" : ""

Now let’s open our Web browser and type

in the address bar. You will be asked to set an identity for your computer. Then click Add Folder link on the upper left corner to choose your shared folder.

bittorrent sync web gui

If it gives you a warning “Don’t have permissions to write to the selected folder.”, then here is a quick and dirty trick to grant write permission to the btsync user.

Let’s say you want to select /home/your_username/btsync_share as the shared folder. Then run this command.

sudo setfacl -R -m "u:btsync:rwx" /home/your_username/btsync_share

The above command won’t change the owner of the shared folder. The owner has the same permissions as usual. What it does is grant read, write and execute permissions to one more user, namely btsync.

Now you can use link, key and QR code to share, sync your folder!

Using BitTorrent Sync on Ubuntu 16.04 Server

By default, btsync process only listens on So if you install btsync on Ubuntu 16.04 server, you won’t be able to access the Web GUI from your computer. To be able to access the Web GUI from a remote connection, we can set up Nginx reverse proxy for btsync.

First install Nginx on Ubuntu 16.04 server.

sudo apt install nginx

Start Nginx and enable auto start.

sudo systemctl start nginx

sudo systemctl enable nginx

Then create a server block file under /etc/nginx/conf.d/

sudo nano /etc/nginx/conf.d/btsync.conf

Paste the following lines in the file. Replace with your real domain name. You should also point your domain name to the IP address of your Ubuntu 16.04 server.

server {
  listen 80;

  access_log /var/log/nginx/;
  location / {

Save and close this file. Reload Nginx.

sudo systemctl reload nginx

Now in your browser’s address bar type your domain name and you should be able to access the Web GUI.

Secure the BitTorrent Sync Web GUI

Password Protect

By default, the above configuration allows anyone to access the Web management interface. We can set up a username and password by clicking the gear icon on the upper right corner, then click Preferences.

secure BitTorrent Sync Web GUI

Click the login tab and enter a username and password. Since this is a new account, you can leave Current password field blank.

bittorrent sync web.png

Install a TLS/SSL Certificate

To prevent hackers sniffing username and password, you can acquire and install a TLS/SSL certificate. As you may already know, Let’s Encrypt now provide free TLS/SSL certificate which can be easily obtained and installed.

Here’s how to install and configure Let’s Encrypt TLS/SSL certificate with Nginx on Ubuntu 16.04 server.

Install letsencrypt

sudo apt install letsencrypt

Stop Nginx server.

sudo systemctl stop nginx

Then issue the following command to obtain certificate.

letsencrypt certonly --email <your-email-address> -d <your-domain-name>

The certonly subcommand is used to tell letsencrypt client to obtain the certificate, but do not install it, since it does not support auto configuration for Nginx at the time of this writing.

Email address is used for urgent notices and lost key recovery. Replace <your-email-address> with your real email address, replace <your-domain-name> with your real domain name.

You will be asked to read and agree to the terms of service.

letencrypt certbot

You can also add –agree-tos option to automatically agree to the terms of service.

letsencrypt certonly --agree-tos --email <your-email-address> -d <your-domain-name>

Within a few seconds, you should see a congrats message like below.

Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/yourdomain/fullchain.pem.

Next, let’s configure Nginx TLS/SSL settings. Open /etc/nginx/conf.d/btsync.conf again.

sudo nano /etc/nginx/conf.d/btsync.conf

Change the content of this file to the following. Replace with your real domain name.

server {
  listen 80;
  return 301$request_uri;
server {
  listen 443 ssl;

  ssl_protocols TLSv1.1 TLSv1.2;
  ssl_certificate /etc/letsencrypt/live/;
  ssl_certificate_key /etc/letsencrypt/live/;

  access_log /var/log/nginx/;
  location / {

Save and close the file. Now start Nginx again.

sudo systemctl start nginx

Go to your BitTorrent Sync Web GUI again, you will find HTTP connection is automatically redirected to HTTPS secure connection.


Rate this tutorial
[Total: 1 Average: 5]
  • nolotus

    thank you ~

  • Jay Gatsby

    is there a second step that would allow me to add files as my normal user to folders that btsync adds? Permissions . . .

    • As pointed out in the tutorial, the following command will grant read, write and execute permission of your normal user’s folder to the btsync user.

      sudo setfacl -R -m “u:btsync:rwx” /home/your_username/btsync_share

      So if you like to add files as your normal user to folders that btsync adds, then just replace btsync with your username.

      sudo setfacl -R -m “u:your_username:rwx” /folder/added/by/btsync

      This way, both your normal user and btsync have read, write and grant permission

      • Jay Gatsby

        Thank you!!

  • Johan Wyckmans

    I get certificate error in letsencrypt. IP-Adress certificate are not allowed!!

    • Let’s Encrypt has decided not to issue certificates for bare IP addresses. You have to apply certificate for a domain name.

  • Johan Wyckmans

    This is my “less-secure” method, which I tested and works on “open” VPS’s with ubuntu 16.04.1! I composed this shell-script by combining a few tutorials I found on the internet, which none seemed to workout! Here is a solution;;

    sudo apt-get update
    sudo apt-get install wget git nano ufw
    sudo apt-get update
    sudo sh -c ‘echo “deb btsync non-free” > /etc/apt/sources.list.d/btsync.list’
    sudo wget | sudo apt-key add key.asc
    sudo apt-get update
    sudo apt-get install btsync
    sudo systemctl start btsync
    sudo systemctl enable btsync
    sudo apt-get update
    sudo ufw allow 80
    sudo ufw allow 443
    sudo ufw allow 8888
    sudo ufw allow 80/tcp
    sudo ufw allow 80/udp
    sudo ufw allow 443/tcp
    sudo ufw allow 443/udp
    sudo ufw allow 8888/tcp
    sudo ufw allow 8888/udp
    sudo ufw allow 3000
    sudo ufw allow 3000/tcp
    sudo ufw allow 3000/udp
    sudo ufw allow 123
    sudo ufw allow 123/tcp
    sudo ufw allow 123/udp

    Make sure that after running these commands, to keep in mind the following three things!
    1- sudo nano /etc/btsync/config.json #Change the listen IP-address to your VPS it’s external IP. (to find out IP-Address, use: ifconfig #if necessary)
    2- sudo setfacl -R -m “u:btsync:rwx” /root/home/orwhateverdirectory/you/want/to/share!!! #don’t forget to run these commands for both users root and btsync. BEWARE TO RUN THESE COMMANDS ONLY IF NECESSARY. If BT-sync runs anyway, don’t use an overdose of unnecessary commands!! Usage of more commands can only increase destabilisation of your system, and may also mess-up more configuration files. #don’t forget to checkup the portnumber BT-sync uses to make connection with other peers. You can find this port under preferences(tab in de settings area in the right top of the webui) and run::: sudo ufw allow [portnumber]
    3- A proper reboot by “sudo reboot” after initial installation is always a better way to start the day!
    This method is less-secure!
    However, this method worked better for me, since both NGINX and letsencrypt have both their problems during setup. NGINX did only redirect the webui. I was able to see and make use of the web-interface, but no peers connected to my server!
    The problem with letsencrypt was, that I wasn’t able to use of my bare-ip address to sign my certificate. In my circumstances that would mean that letsencrypt wasn’t an option for me either. Therefore, this method is less-secure, but works for now(also better cpu-usage since no proxy server is redirecting traffic)

    • Hi, thanks for sharing this. I just want to point out that Nginx only serves the web interface. It has nothing to do with connecting peers together which is the job of btsync. Anyway, it’s great that this method works for you.

      Edit: Maybe that’s because I didn’t mention allowing btsync through the firewall in the tutorial.