Syncthing is open-source software that syncs folders between your devices, such as your laptop, PC, and smartphone. Devices connect directly to each other using encryption, without a central account or cloud service. Each device has its own Device ID, and only devices you have mutually approved exchange data. On a VPS, Syncthing becomes a device that's always online: your other devices sync through the server, even if they are never switched on at the same time, and the server keeps a copy of your data along with older versions. In this guide, we'll show you two ways to set it up: the easy way with a One-Click App, and a manual installation with Docker Compose. Then you'll pair your devices, share your first folder, enable versioning, and set up the server as a backup destination.
Syncthing doesn't need a server; it also works between just two PCs. Adding a VPS as another device is useful if:
- your devices are rarely online at the same time. Without a device that's always reachable, your laptop and PC only sync when both are online. The server receives changes right away and passes them on as soon as the next device comes online.
- you want an off-site copy. A folder that the server only receives becomes an up-to-date copy of your data in a data center, with versioning to protect against accidental deletion.
- you don't need a cloud service with an account and web interface. Syncthing only syncs folders. It doesn't have user accounts, sharing links, or a file browser.
- your devices are behind different routers. The server has a fixed public IP address, so your devices can connect to it directly without you needing to open ports at home.
Syncthing is less suitable if you want to share files with other people using a link, edit them in a browser, or sync calendars and contacts. That's what a cloud service like Nextcloud is for. Syncthing also isn't a backup program with restore points for an entire folder. Syncing also transfers deletions; only versioning and a receive-only folder protect you from that.
Both keep files up to date across multiple devices, but they work in very different ways:
| Syncthing | Nextcloud | |
|---|---|---|
| How it works | Devices sync directly with each other; the VPS is one of many devices | A central server that devices connect to with a user account |
| Browser access | Management only, no file browser | Files, sharing, office tools, calendars, and more |
| Sharing with others | Only with approved devices that use Syncthing | Sharing links, groups, guests |
| Resource usage | Very low; no database server | Web server, PHP, and database |
| Smartphone | Community apps for Android; only third-party apps on iOS | Official apps for Android and iOS |
If you simply want to keep your folders the same across all your devices, Syncthing is more lightweight. If you want your own cloud with accounts and sharing, choose Nextcloud.
The fastest way to get Syncthing is through your VPS's One-Click Apps. The web interface is accessible directly over HTTPS using a domain, and is protected by a login from the start. The synchronization ports are also published on your server automatically.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps for instructions.
- Syncthing itself is lightweight; 1 GB of RAM is enough to get started. Plan for enough storage for your data, plus extra space for older versions.
- Ports
22000(TCP and UDP) and21027(UDP) must be available on the server.
- Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
- Search the app catalog for Syncthing and click Install app.
- Use a custom subdomain or zap.cloud is already selected with a random name. Leave this option enabled or enter a custom name, such as
sync. You'll use this address to access the web interface over HTTPS. - Under App configuration, the only setting is
TZfor the time zone. The default isEtc/UTC. For Germany, enterEurope/Berlin, or leave the default value. - Under Automatically generated values, you'll see the variables
SERVICE_USER_SYNCTHINGandSERVICE_PASSWORD_SYNCTHING. These are used to create your web interface login during installation. You don't need to enter anything. - Click Queue installation.
The app will be online after a minute or two. Under Connection on the app card, you'll see the addresses SERVER_IP:22000 and SERVER_IP:21027. Your devices connect to the server over port 22000.
The One-Click App's web interface is protected by a login that's set up when the app starts for the first time. Without it, nobody can add devices or share folders. The Login notice on the app card indicates this. Here's how to sign in:
- On the app card, click the gear icon and go to App environment.
- Under Automatically generated values,
SERVICE_USER_SYNCTHINGcontains the username andSERVICE_PASSWORD_SYNCTHINGcontains the password. Click the eye icon to show a value, or the icon next to it to copy it. - Open Syncthing using the Access link. Syncthing will show the “Authentication Required” login page. Enter both values.
- If Syncthing then asks about anonymous usage reporting (“Allow Anonymous Usage Reporting?”), select Yes or No.
It's best to save the login details in your password manager. You can't change the values in App environment.
If you want to use a custom password, change it directly in Syncthing:
- In the top-right corner, click Actions > Settings, then go to the GUI tab.
- Enter a username under GUI Authentication User and a strong password under GUI Authentication Password.
- Click Save.
The app only applies the generated login as long as no username has been set in Syncthing. A custom password therefore remains in place after restarts and updates. From that point on, the values in App environment no longer apply, so make sure you keep your password safe.
The notice “The GUI address is overridden by startup options” on the same tab is normal. The app sets the web interface address so it's accessible through your domain. Don't change GUI Listen Address.
The app has three storage areas: /config for settings, device keys, and the database, and /data1 and /data2 for your data. Create your folders in /data1 or /data2. For Folder Path, enter a path such as /data1/Documents or /data1/Laptop-Backup. Syncthing creates the folder when you save. This keeps your data and settings separate, and lets you use two areas, for example, one for your documents and another for backups from other devices.
The default path Syncthing suggests when you create a folder is under ~ (which is /config). This works, but it mixes your data with the app's settings. Change the path to /data1/… or /data2/… before saving.
Syncing uses port 22000 over TCP and UDP (QUIC). Port 21027 (UDP) is only used to discover devices on a local network and isn't useful for a VPS in a data center. The app publishes both ports through the server firewall. If you want to restrict them, use the Network firewall in the ZapX dashboard. If you block port 22000, your devices can only reach the server through Syncthing's public relays. This works, but it's much slower.
Update Syncthing in the app settings (gear icon) under App update. Click Check for updates, then install a new version with Apply update. If it says the app is up to date, there isn't a newer version in the app catalog yet. Syncthing's built-in self-updater is disabled in the app.
Settings and device keys are stored in the /config volume, and your folders are in the /data1 and /data2 volumes. They remain in place during updates. If you delete the data volumes when uninstalling, the data on the server will be lost. Back up your VPS before making major changes, for example, using Backups in the dashboard.
The rest of this guide covers a manual installation of Syncthing with Docker Compose on your VPS. This is useful, for example, if you don't use One-Click Apps on your server or want your data stored in a directory of your choice.
- A Linux VPS running Debian or Ubuntu, with SSH access. See First SSH Connection.
- Docker and Docker Compose (Compose v2). See Install Docker. Verify the installation with
docker --versionanddocker compose version. - Optional: a domain or subdomain with an A record pointing to your VPS's IP address (e.g.,
sync.example.com) if you want to access the web interface over HTTPS.
Syncthing doesn't need a database server and uses very little processing power. RAM usage increases with the number of files because Syncthing keeps an entry for each file in its index database. The following values are guidelines:
| Hardware | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU core | 2 vCPU cores |
| RAM | 1 GB | 2 GB |
| Storage | Amount of data plus 10 GB | Amount of data plus space for versions |
Syncthing needs port 22000 over TCP and UDP for syncing. Don't open the web interface on port 8384; access it through an SSH tunnel or a reverse proxy. With ufw, allow only what's needed:
ufw allow OpenSSH
ufw allow 22000/tcp
ufw allow 22000/udp
ufw enable
For a reverse proxy, you'll also need to run ufw allow 80/tcp and ufw allow 443/tcp later. You don't need port 21027/udp on a VPS; it's only used to discover devices on a local network. Learn more about the firewall in Firewall Management on Linux.
We'll use the official syncthing/syncthing image in host network mode, as recommended by the Syncthing documentation. Docker won't publish ports in a way that bypasses ufw, and the web interface will only listen on 127.0.0.1. Create a directory:
mkdir -p /opt/syncthing/data
cd /opt/syncthing
chown 1000:1000 data
Then create the docker-compose.yml file, for example with nano docker-compose.yml, and add this content:
services:
syncthing:
image: syncthing/syncthing:2
container_name: syncthing
hostname: vserver-sync
restart: unless-stopped
network_mode: host
environment:
- PUID=1000
- PGID=1000
- STGUIADDRESS=
volumes:
- ./data:/var/syncthing
healthcheck:
test: curl -fkLsS -m 2 127.0.0.1:8384/rest/noauth/health | grep -o --color=never OK || exit 1
interval: 1m
timeout: 10s
retries: 3
Here's what the important lines mean:
syncthing/syncthing:2: the official image from the Syncthing developers. The2tag gives you all 2.x versions when you rundocker compose pull.network_mode: host: Syncthing listens directly on the server's ports. There are noports:lines, so Docker won't bypassufwhere.STGUIADDRESS=: clears the image's default setting. The web interface will then listen on127.0.0.1:8384and won't be accessible externally.hostname: this name appears on your other devices as the server's name../data:/var/syncthing: settings are stored in/opt/syncthing/data/config; you can also create your folders under/opt/syncthing/data.PUIDandPGID: Syncthing runs as a user with ID1000, so thedatadirectory belongs to that user.
Pull the image and start Syncthing:
docker compose pull
docker compose up -d
docker compose logs -f syncthing
Syncthing is ready when the log shows a line with GUI and API listening and the address 127.0.0.1:8384. Exit the log view with Strg+C.
The web interface is only accessible from the server itself. Use an SSH tunnel to open it from your PC. Run this on your PC:
ssh -L 8384:127.0.0.1:8384 root@SERVER_IP
Keep the window open, then open http://localhost:8384 in your browser. Unlike the One-Click App, your manual installation doesn't have a login yet. So, immediately set a username and password under Actions > Settings > GUI, as described above in “Optional: set a custom password for the web interface.” You must do this before putting a reverse proxy in front of it. Without a password, anyone with the address could add devices and share your folders.
If you want to access the web interface without an SSH tunnel, set up a reverse proxy in front of it with a valid certificate. For the basics, see Set Up a Reverse Proxy with nginx and Create an SSL Certificate (Let's Encrypt). Make sure you set a password for the web interface first.
When the web interface is on 127.0.0.1, Syncthing checks the Host header and responds to unfamiliar names with “Host check error.” The proxy therefore sends localhost as the Host:
server {
listen 80;
server_name sync.example.com;
location / {
proxy_pass http://127.0.0.1:8384;
proxy_set_header Host localhost;
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_read_timeout 600s;
proxy_send_timeout 600s;
}
}
Then get the certificate with certbot --nginx -d sync.example.com. The long timeouts are needed because the web interface waits for events from Syncthing. For more security tips, see Linux Security Tips.
Besides your data, the most important thing to back up is the config directory. It contains the device key (cert.pem and key.pem) used to generate the Device ID, along with your device and folder lists. Without it, the server gets a new Device ID, and you'll have to pair all your devices again. Back it up while the container is stopped:
cd /opt/syncthing
docker compose stop
tar czf syncthing-config-$(date +%F).tar.gz -C data config
docker compose start
Back up your synced folders like any other data, for example with Rsync. Don't keep backups only on the VPS itself.
Read the new version's Release Notes first. Then pull the new image and restart Syncthing:
cd /opt/syncthing
docker compose pull
docker compose up -d
The built-in self-updater is disabled in the Docker image, so updates are only available through a new image. You can see the installed version in the web interface under This Device, next to Version. Keep all devices on similar versions; very old versions may not always connect to newer ones.
Now you'll connect your PC to the server and share your first folder. You'll also need Syncthing on your PC. Downloads for Windows, macOS, and Linux are available at syncthing.net. The web interface is the same on all devices.
Each device has a Device ID consisting of eight blocks of seven characters each. It's not secret, but only devices that have added each other can connect:
- On the server, open Actions > Show ID and copy the Device ID.
- On your PC, under Remote Devices, click Add Remote Device, paste the ID under Device ID, give the device a name under Device Name, such as
vServer, and click Save. - After a short time, a message will appear at the top of the server saying that a new device wants to connect. Click Add Device, then Save.
If the device shows as “Connected” on both sides, the connection is established. If it stays “Disconnected,” check whether port 22000 is reachable on the server. To make sure your PC finds the server directly instead of using discovery, you can also enter tcp://SERVER_IP:22000 under Addresses in the Advanced tab of the server device's settings on your PC.
A folder is shared using its Folder ID. The ID must be the same on all devices, but each device can use its own path:
- On your PC, click Add Folder.
- Enter a name under Folder Label and select the folder on your PC under Folder Path.
- In the Sharing tab, check the box for your server and click Save.
- The server will ask if you want to accept the folder. Click Add, enter a path on the server under Folder Path (for example,
/data1/Documentsfor the One-Click App or/var/syncthing/Documentsfor the manual installation), and click Save.
Syncthing will now sync the folder. You can see the progress in the folder list on both devices. To add another device, such as a second PC, share the same folder with the server only. All devices that have the folder will then stay up to date through the server.
If you delete or overwrite a file on your PC, the same change happens on the server. With versioning, the server keeps the previous version. Edit the folder on the server and choose a method in the File Versioning tab:
| Method | What it does |
|---|---|
| Trash Can File Versioning | Keeps deleted and replaced files like a recycle bin, optionally for a set number of days |
| Simple File Versioning | Keeps the most recent versions of each file. Set the number under Keep Versions |
| Staggered File Versioning | Keeps versions on a staggered schedule: every 30 seconds for the first hour, hourly for the first day, daily for 30 days, then weekly until the maximum age |
| External File Versioning | Runs a custom script |
Older versions are stored in the .stversions subfolder of the folder on the server. Important: versioning only applies to changes received from another device. Staggered File Versioning is usually the best choice when using the server as a backup destination, but make sure you have extra storage space for it.
If the server should only keep a copy and never send its own changes to your devices, set the folder on the server to Receive Only under Folder Type in the Advanced tab:
- Changes from your devices are received by the server, but changes on the server aren't sent back.
- If something does change on the server, Syncthing shows the folder as “Local Additions.” Click Revert Local Changes to restore the state of your devices.
- Combined with versioning, this gives you an up-to-date copy with older versions.
On your PC, you can set the same folder to Send Only if the PC should be the only source. Keep in mind that if you delete a file on your PC, it will also disappear from the folder on the server. You can only restore it from .stversions or a backup. A Receive Only folder therefore isn't a replacement for a backup with fixed restore points.
If you want only encrypted data to be stored on the server, enter a password for the server in the Sharing tab when sharing the folder from your PC. Then create the folder on the server with the Receive Encrypted type. The server stores and distributes the data, but can't read it. The Syncthing documentation marks this feature as beta. Keep the password safe; you won't be able to access the data without it.
- Not a cloud service: Syncthing doesn't have a file browser, sharing links, or user accounts. For these, you'll need a solution like Nextcloud or File Browser.
- Deletions are synced: Without versioning, a deleted file is gone from all devices.
- Conflicts: If you edit the same file on two devices before they sync, Syncthing keeps both versions and adds
.sync-conflictto one of the filenames. - Smartphones: Community apps are available for Android. There is no official iOS app, only third-party apps.
- Relays are slow: If two devices can't connect directly, traffic is routed over public relays with limited bandwidth. Keep port
22000reachable on the server so your devices can connect directly.
With Syncthing, your server is now an always-available node that syncs your folders between your devices through the protected web interface and, with versioning and the Receive Only folder type, keeps an off-site copy of your data. Next, Set Up File Browser on a Linux Server shows you how to manage the synced files on your server in your browser and share them via links.
If you have any other questions or need help, our support team is available every day! 🙂
