Software & Configuration

Syncthing

Install and configure Syncthing for decentralized file synchronization between servers and devices

Syncthing is an open-source, peer-to-peer file synchronization tool. Unlike Nextcloud, it has no server component, all devices sync directly with each other. Ideal for syncing backups, configs, or documents between VPS and local machines.

Requirements

  • Ubuntu/Debian VPS
  • Port 22000 (TCP/UDP) open for sync traffic
  • Port 8384 open locally (web UI, bind to localhost only)

Installation

Add the official Syncthing repository:

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

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

sudo apt update
sudo apt install syncthing -y

Run as a systemd service

Run Syncthing under your user (not root):

sudo systemctl enable syncthing@$USER
sudo systemctl start syncthing@$USER

Check status:

systemctl status syncthing@$USER

Access the web UI

By default the UI listens on 127.0.0.1:8384. To access it remotely, use an SSH tunnel:

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

Then open http://localhost:8384 in your browser.

Never expose port 8384 directly to the internet without authentication and HTTPS. Use an SSH tunnel or put it behind a reverse proxy.


Configure via web UI

  1. Open http://localhost:8384
  2. Set a GUI password immediately: Actions → Settings → GUI → set username and password
  3. Note your Device ID (Actions → Show ID), you'll need this to pair devices

Add a shared folder

  1. Click Add Folder
  2. Set the folder path (e.g. /home/user/sync)
  3. Set a Folder ID (used to match on other devices)
  4. Under Sharing, select which devices can sync this folder
  5. Save

Pair a second device

On the second device (another VPS or your PC):

  1. Install Syncthing the same way
  2. Open the web UI → Add Remote Device → paste the Device ID from the first server
  3. On the first server, accept the connection request that appears
  4. Share folders between the paired devices

Firewall rules

Open port 22000 for Syncthing sync traffic:

sudo ufw allow 22000/tcp
sudo ufw allow 22000/udp

If you use direct discovery (local LAN), also allow:

sudo ufw allow 21027/udp

Reverse proxy with Nginx (optional)

To access the UI at https://sync.yourdomain.com:

server {
    listen 443 ssl;
    server_name sync.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/sync.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/sync.yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:8384;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_read_timeout 600s;
        proxy_send_timeout 600s;
    }
}

Then in Syncthing UI → Settings → GUI, set GUI Listen Address to 127.0.0.1:8384 and enable Use HTTPS for GUI = off (Nginx handles SSL).


Ignore files

Create a .stignore file in any synced folder to exclude patterns:

*.log
*.tmp
.git
node_modules
__pycache__

Useful commands

CommandDescription
systemctl restart syncthing@$USERRestart the service
systemctl status syncthing@$USERCheck service status
journalctl -u syncthing@$USER -fLive logs
syncthing --versionCheck version

Upgrade

sudo apt update && sudo apt upgrade syncthing -y

On this page