Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers in real time, safely protected from prying eyes. Your data is your data alone and you deserve to choose where it is stored, whether it is shared with some third party, and how it’s transmitted over the internet.
Features:
For this tutorial, we will assume that Syncthing will be installed on a remote GNU/Linux server or computer. You do not need to port forward to make Syncthing work. Follow this guide if you use Debian, other Linux distro should be similar but yours may vary.
Installing Syncthing on a Debian based distro:
Steps are from https://apt.syncthing.net/
Importing the signing key for Syncthing devs:
$ sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
Importing the Syncthing repo:
$ echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
Updating the package cache and installing Syncthing:
$ sudo apt update
$ sudo apt-get install syncthing
Sample output:
$ sudo apt-get update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Hit:2 https://download.docker.com/linux/debian buster InRelease
...
$ sudo apt-get install syncthing
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be upgraded:
syncthing
1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 9,850 kB of archives.
After this operation, 4,139 kB of additional disk space will be used.
Get:1 https://apt.syncthing.net syncthing/stable amd64 syncthing amd64 1.18.1 [9,850 kB]
Fetched 9,850 kB in 1s (12.0 MB/s)
(Reading database ... 70942 files and directories currently installed.)
Preparing to unpack .../syncthing_1.18.1_amd64.deb ...
Unpacking syncthing (1.18.1) over (1.12.1~ds1-4) ...
Setting up syncthing (1.18.1) ...
Installing new version of config file /etc/ufw/applications.d/syncthing ...
At this point Syncthing must be installed. Allow syncthing on the firewall if you have one. But this is out of the scope for now.
For us to access the Syncthing Web User Interface, we need to reverse proxy it to our already installed web server. In this case, I assume that you already have an installed webserver such as nginx (pronounced as eNgine X). Below are the sample configuration, note you also need to specify a CNAME or A record to point to our syncthing page.
Create a new configuration:
$ sudo nano /etc/nginx/sites-available/syncthing.conf
The sample configuration:
This configuration is derived from https://docs.syncthing.net/users/reverseproxy.html.
Edit the following:
ssl_certificate
full path.
server_name
directive, must match your DNS A Record.
server {
listen 443 ssl http2;
ssl_certificate /var/letsencrypt/sites/domain/fullchain.pem;
ssl_certificate_key /var/letsencrypt/sites/domain/privkey.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:10m;
ssl_session_tickets off;
# intermediate configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
server_name sync.domain.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:8384/;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
}
}
Activate that configuration:
$ sudo ln -s sudo nano /etc/nginx/sites-available/syncthing.conf sudo nano /etc/nginx/sites-enabled/syncthing.conf
Before reloading the webserver, check if all is well:
$ sudo nginx -t
The output when the configuration is Ok:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Running syncthing
$ syncthing
Visit your syncthing URL and start adding devices that would be synced.
Based on the configuration above, it must be https://sync.domain.com
.
Syncthing is also available on Android (Google Play and F-droid) but there isn’t an official iOS version due to some limitations.
References:
https://syncthing.net/downloads/