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 topHow 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:
- Install Syncthing on both devices.
- On the first device, open Actions > Show ID. The device ID is a long code.
- On the second device, open Add Remote Device and type in that ID.
- Go back to the first device and accept the new device.
- 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 topHow 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 openhttp://127.0.0.1:8385.
Sources
- Syncthing: official website
- Syncthing documentation: Getting Started
- Syncthing documentation: Block Exchange Protocol
