(Last Updated On: July 24, 2018)

Syncthing is an open source continuous file synchronization used to sync files between two or more computers in a network. This guide will cover the installation and usage of Syncthing on Ubuntu 18.04.

Below are key features of Syncthing

  • It is easy to use through a cli and GUI through  Syncthing-GTK
  • Its data syncing fully automatic – Low interaction
  • Synthing strives to be safe from data loss – Ensures no corruption on user’s files.
  • It is universally available – Runs on both Windows and Linux

Installing Syncthing on Ubuntu 18.04

The Syncthing package is available on the official repository which can easily be added by running the following commands on your terminal. Start by installing curl package.

$ sudo apt install curl apt-transport-https

Once curl is installed, import GPG Key for the repo:

curl -s https://syncthing.net/release-key.txt | sudo apt-key add -

When GPG Key has been added, create repo content:

echo "deb https://apt.syncthing.net/ syncthing release" > /etc/apt/sources.list.d/syncthing.list

Then update system and install syncthing package:

$ sudo apt-get update
$ sudo apt-get install syncthing

Once installed, check version:

$ syncthing --version
syncthing v0.14.48 "Dysprosium Dragonfly" (go1.10.2 linux-amd64) 
[email protected] 2018-05-14 06:53:06 UTC [noupgrade]

Configuring Syncthing on Ubuntu 18.04

Now that we have syncthing installed, let’s proceed to the configuration section. Since Ubuntu 18.04 is a systemd compliant, we can create systemd unit files to manage syncthing service. Service files for systemd are provided by Syncthing and can be found in etc/linux-systemd

$ sudo vim /etc/systemd/system/[email protected]

Add content below:

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target

[Service]
User=%i
ExecStart=/usr/bin/syncthing -no-browser -gui-address="192.168.1.20:8384" -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

[Install]
WantedBy=multi-user.target

Replace 192.168.1.20 with your system IP address then update systemd service list:

$ sudo systemctl daemon-reload

Then start syncthing service:

$ sudo systemctl start [email protected]

E.g

$ sudo systemctl start [email protected]
$ sudo systemctl start [email protected]

Accessing Syncthing UI

The Syncthing admin GUI is started automatically by systemd and is available on https://192.168.1.20:8384/. If the -gui-address="ip:port" option is not provided, the service will run on https://localhost:8384/

On accessing Syncthing GUI,  you should see an interface like below:

The first thing to do is set admin user account and password. Navigate to Actions > Advanced

Set User and Password. Also recommended to tick Use TLS for https connection only.

Syncing data between two devices with Syncthing

For you to be able to sync data between two or more computers with Syncthing, ensure Syncthing has been installed and configured on all systems. Once setup is done,  each device must be told about the other device.

Synthing Device ID

This is accomplished by exchanging “device IDs“. A device ID is a unique, cryptographically-secure identifier that is generated as part of the key generation the first time you start Syncthing. Two devices will only connect and talk to each other if they are both configured with each other’s device ID. Obtain Device ID from Actions > Show ID

Adding Syncthing Device ID

To get your two devices to talk to each other click “Add Remote Device” at the bottom right on both, and enter the device ID of the other side.

Also, select the folder(s) that you want to share. The device name is optional and purely cosmetic. It can be changed later if required. Once you click “Save” the new device will appear on right side of the GUI (although disconnected) and a prompt will be shown to indicate the need for a restart.

Note: The default folder being shared is ~Sync. When you have made changes like adding Sync directories, ensure you restart Syncthing on “Actions” > “Restart”.