Install BitTorrent Sync on Ubuntu 16.04 from Official Deb Repository

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]