Skip to content
Created: 2022-04-21 | Last update: 2022-04-24

Syncthing

Syncthing Logo

Syncthing is a continuous file synchronization program. Syncthing is an application that allows you to synchronize files between multiple devices. This means that creating, editing, or deleting files on one computer can be automatically copied to other devices.

Official website: syncthing.net

Debian/Ubuntu Installation

We need to add the following Syncthing repository to the system.

First, we need to add PGP keys to allow the system to check the packages authenticity

sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg

Then we will add the stable Syncthing repository channel to your APT sources

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

Now we can update the package list and install Syncthing

sudo apt update
sudo apt install syncthing

Configuration Syncthing as a Service

Configuring Syncthing as a service will provide as the ability to start and stop and enable/disable the service at boot.

Create a systemd unit file for managing the Syncthing service.

nano /etc/systemd/system/syncthing@.service

In the next example we will be setting the Syncthing service UI to listen on local host (127.0.0.1) and port 8384

Add the following lines to the syncthing@.service:

[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="127.0.0.1:8384" -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

[Install]
WantedBy=multi-user.target

Save and close the file when you are finished. Then, reload the systemd daemon to apply the configuration:

systemctl daemon-reload

Next, start the Syncthing service with the following command depending on a user this example is root

systemctl start syncthing@root

To verify the status of the Syncthing service, run the following command:

systemctl status syncthing@root

Finally, enabled the syncthing service on boot

systemctl enable syncthing@root

MacOS Installation

You can download the MacOS installation package from Syncthing Downloads, But my preferred way is to use the Homebrew package manager.

brew install --cask syncthing

Windows Installation

Window installation from Syncthing Downloads installs the Syncthing as a service without any system tray icon or menu.

The best way I found is to use SyncTrayzor from SyncTrayzor Github Page. It hosts and wraps Syncthing, making it behave more like a native Windows application and less like a command-line utility with a web browser interface.

You can also instal it win winget with the following command:

winget install SyncTrayzor.SyncTrayzor

Synology DSM Installation

In order to install Syncthing, we need to add 3rd party packages to Synology DSM. Synology Community Packages provides packages for Synology-branded NAS devices.

After we added Synology Community Packages you will be able to install Syncthing from the Cummunity tab.

Permissions for the Syncthing service will be handled by the new system user sc-syncthing

Synology Permission

Syncthing Configuration

The following configuration are the same for all the installation methods. I'm no going to cover the basic configuration, but I will show you some of my personal preferences.

First to configure the Syncthing we need to access it's Web UI. The Default url is http://127.0.0.1:8384

If you are using Syncthing at remote Linux host, you can use SSH tunnel to access the Web UI.

ssh  -L 8001:127.0.0.1:8384 root@192.168.102.6

This will forward 127.0.0.1:8384 from the remote host to 127.0.0.1:8001 on the local host.

For security reasons, I like to disable all the Discovery and Repay services.

Syncthing Disable Discovery

When you disable the Discovery service, you will have to manually add the connection to other devices.

Example:

tcp://192.168.1.1:22000

Syncthing Manual Connection

Syncthing supports of Ignore Patterns you can use it to Ignore Files synchronization.

Here is a list of the Ignore Patterns for system files:

Photos Library.photoslibrary
(?d).DS_Store
(?d)@eaDir
(?d)Icon
(?d).AppleDouble
(?d).LSOverride
(?d).LSOverride

Example of working Syncthing Web UI:

Syncthing Web UI

Comments

Back to top