TutorialsAugust 4, 20265 min read

How to Self-Host Syncthing for File Sync

Syncthing keeps folders in sync across your devices with no cloud provider in between. Run it on a VPS as an always-on relay so devices sync even when they're not both online.

NBy Nxeon

Syncthing is a peer-to-peer, continuous file-synchronisation tool. Unlike Dropbox, there's no central cloud — your devices sync directly, with traffic encrypted end to end. The catch with pure peer-to-peer is that both devices must be online at once. Running Syncthing on an always-on VPS solves that: the server acts as a permanent sync hub so your laptop and phone stay in sync even when they're never on together.

How this differs from Nextcloud

Nextcloud is a full cloud suite with a web UI, sharing links and apps. Syncthing does one thing — sync folders between devices — extremely well, with no accounts and less overhead. If you just want folders mirrored across machines, Syncthing is simpler and lighter.

Prerequisites

  • A VPS with Docker installed — run Docker on a VPS.
  • The Syncthing app or binary on your other devices.

Deploy Syncthing

mkdir -p ~/syncthing && cd ~/syncthing
services:
  syncthing:
    image: syncthing/syncthing:latest
    container_name: syncthing
    restart: unless-stopped
    hostname: vps-sync
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - ./config:/var/syncthing/config
      - ./data:/var/syncthing/Sync
    ports:
      - "8384:8384"      # web UI
      - "22000:22000/tcp" # sync protocol
      - "22000:22000/udp"
      - "21027:21027/udp" # discovery
docker compose up -d

Reach the web UI safely

By default the admin UI listens on 8384 but only on localhost inside the container. The safe way to reach it is an SSH tunnel from your machine — no need to expose it publicly:

ssh -L 8384:localhost:8384 user@your-server-ip

Then open http://localhost:8384 in your browser. Set a GUI username and password immediately under Settings → GUI.

NVMe block-storage volumes in the Nxeon control panel
NVMe block-storage volumes in the Nxeon control panel

Open the sync ports

The sync protocol itself needs its port open so devices can connect:

sudo ufw allow OpenSSH
sudo ufw allow 22000/tcp
sudo ufw allow 22000/udp
sudo ufw enable

Pair a device

Every Syncthing node has a unique Device ID. On the VPS web UI, copy its Device ID (Actions → Show ID). On your laptop's Syncthing, click Add Remote Device, paste the VPS ID, and accept the pairing prompt that appears on the server. Then share a folder from one side; the other accepts it and syncing begins.

Because the VPS is always on, add every device to it and they'll all converge through the server — even devices that are never online at the same time.

Versioning and safety

Enable File Versioning on shared folders so an accidental deletion on one device doesn't wipe the file everywhere. Syncthing keeps old versions on the server you can restore from — a simple safety net that turns sync into a lightweight backup.

Ignore patterns and handling conflicts

Two features keep real-world sync tidy. First, ignore patterns: add a .stignore file to a shared folder to skip things you don't want synced — build artefacts, caches, huge temporary files. A typical list:

.DS_Store
node_modules
*.tmp

Second, understand conflict files. If the same file is edited on two devices before they sync, Syncthing keeps both and renames one to filename.sync-conflict-…. Nothing is lost — you just open both and merge. This is precisely why Syncthing is a sync tool, not a substitute for a real backup.

Folder types and one-way sync

By default folders are Send & Receive (changes flow both ways). You can also set a folder to Send Only (this device pushes changes but ignores incoming ones) or Receive Only (a read-only mirror). These are perfect for using the VPS as a central archive: make the server folder Receive Only if you want it to collect from devices without ever pushing changes back. Combine that with file versioning and you have a robust sync hub that also guards against accidental deletions.

Discovery, relays and staying private

Syncthing finds other devices in three ways, and it's worth knowing which you're relying on:

  • Global discovery lets devices find each other by ID over the internet — convenient, and how your laptop reaches the VPS from anywhere.
  • Relays kick in when two devices can't connect directly (both behind restrictive NAT). Traffic is still end-to-end encrypted, but it takes a slower path — which is exactly why an always-on VPS with an open port is valuable: it accepts direct connections and skips the relay.
  • Local discovery covers devices on the same network.

For a tighter setup, you can disable global discovery and relays and connect devices by explicit address, so your sync never touches shared infrastructure. Whichever you choose, the VPS's direct-connectable port (22000) is what makes it a fast, reliable hub. Set a GUI password, keep the admin interface off the public internet, and let the sync protocol do its thing.

FAQ

Is Syncthing a backup tool?

Not by itself — it's a sync tool, so a deletion propagates. Enable file versioning to get backup-like protection, but keep a separate real backup for anything critical.

Do I have to open ports on my home network?

No. That's the beauty of a VPS hub — devices connect out to the always-on server, so you don't need port forwarding at home.

Is Syncthing traffic encrypted?

Yes, all transfers are encrypted with TLS between devices. The relay/hub can't read your data.

Syncthing or Nextcloud?

Syncthing for lightweight folder sync with no web interface or accounts; Nextcloud for a full cloud with sharing, apps and a web UI. See the Nextcloud guide to compare.

Give your devices an always-on sync hub on an affordable VPS with full root access — browse the VPS plans to start.

#syncthing#file-sync#docker#self-hosting#backup#seobatch

Deploy your first server in under a minute

Creating an account is free and takes no card details. You pay when you deploy — choose a billing term and pay from your wallet or by card at checkout.