Skip to main content

Syncthing: Keep Files in Sync Without a Cloud

Syncthing is a free, open source program that keeps the same folders up to date on all of your own devices. It does not put your files on a company server, as Dropbox or Google Drive do: your devices send the files to each other directly, and encrypted. You can run it on Linux, Windows, macOS, the BSDs and Android.

What it means

A lot of people rely on a cloud service to see the same files on a laptop, a desktop and a phone. This works. But your files then live on computers that a company owns, the space is limited, and more space often costs a monthly fee.

Syncthing does the same job without a company in between. Your devices connect to each other. Change a file on your laptop, and Syncthing passes that change on to your other devices.

Picture two friends who each keep a copy of one notebook. Whenever one of them writes something new, they phone the other and read the change aloud. No third person ever holds a copy.

There are two limits to keep in mind. No copy exists online, so at least two of your devices must be switched on at the same time before they can sync. Also, Syncthing copies changes; it does not make backups. Delete a file on one device and it disappears on the others too, unless file versioning is turned on.

Back to top

How to use it

Most distributions include Syncthing in their package sources. On Debian and Ubuntu:

sudo apt install syncthing

This installs the Syncthing package.

systemctl --user enable --now syncthing.service

This starts Syncthing as a user service, so it runs in the background after every login.

Now open the web interface at http://127.0.0.1:8384. Syncthing asks you to choose a password. Set one, above all on a computer that several people share.

Connecting two devices takes five steps:

  1. Install Syncthing on both devices.
  2. On the first device, open Actions > Show ID. The device ID is a long code.
  3. On the second device, open Add Remote Device and type in that ID.
  4. Go back to the first device and accept the new device.
  5. Share a folder: click Edit on the folder, open the Sharing tab and pick the other device.

On Android, the app is Syncthing-Fork. F-Droid and Google Play both offer it.

You can keep older versions of changed or deleted files. In the folder settings, open File Versioning and pick an option such as Staggered File Versioning.

Back to top

How it works

Each Syncthing installation has its own key pair and certificate. The device ID is a hash of that certificate. During a connection, both sides compare the other's certificate with the device ID they expect, which stops one device from posing as another. TLS encrypts all traffic.

Devices can find each other in more than one way. Inside a local network, they send local discovery broadcasts to announce themselves. Across the internet, they ask global discovery servers, which store only the address where each device ID can be reached. Sometimes a direct connection fails, for example when strict firewalls protect both devices. The traffic then goes through a relay, which forwards the encrypted data but cannot read it.

The file transfer itself uses the Block Exchange Protocol. Syncthing cuts every file into blocks and computes a hash for each one. After a change, only the blocks that differ travel over the network. Every device holds an index of all files and blocks, so it can fetch blocks from several devices at the same time.

A few points for daily operation:

  • Syncthing uses TCP port 22000, plus UDP ports 22000 and 21027. Open these in your firewall to get the best speed on a local network.
  • A conflict occurs when a file changes on two devices before they sync. Syncthing keeps both versions and gives one of them the name .sync-conflict-….
  • On a server with no desktop, reach the web interface through an SSH tunnel: ssh -L 8385:127.0.0.1:8384 user@server, then open http://127.0.0.1:8385.
Back to top

Sources

Back to top
The welovelinux penguin

The byline of welovelinux news articles. AI helps us write the first draft, and a human editor, Peter Martin, checks every article against its sources before it is published.

Frequently asked questions

No, it is a sync tool. When you delete a file on one device, it is deleted on the others too, unless you turn on file versioning. You find it in the folder settings, under File Versioning, for example Staggered File Versioning.

Yes. Syncthing keeps no copy online, so at least two of your devices must be on at the same time to sync. The devices send the files directly to each other, encrypted.

Install Syncthing on both devices. On the first device, choose Actions > Show ID to see the device ID. On the second device, choose Add Remote Device and enter that ID. Then accept the new device on the first device and share a folder with it.

No. All traffic is encrypted with TLS. Relays are only used when no direct connection is possible, for example when both devices are behind a strict firewall. They only pass on the encrypted data and cannot read it.

That is a conflict. Syncthing keeps both versions of the file and renames one of them to a name with .sync-conflict- in it. You can then check both files and decide which one to keep.