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
8384open 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 -yRun as a systemd service
Run Syncthing under your user (not root):
sudo systemctl enable syncthing@$USER
sudo systemctl start syncthing@$USERCheck status:
systemctl status syncthing@$USERAccess 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-ipThen 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
- Open
http://localhost:8384 - Set a GUI password immediately: Actions → Settings → GUI → set username and password
- Note your Device ID (Actions → Show ID), you'll need this to pair devices
Add a shared folder
- Click Add Folder
- Set the folder path (e.g.
/home/user/sync) - Set a Folder ID (used to match on other devices)
- Under Sharing, select which devices can sync this folder
- Save
Pair a second device
On the second device (another VPS or your PC):
- Install Syncthing the same way
- Open the web UI → Add Remote Device → paste the Device ID from the first server
- On the first server, accept the connection request that appears
- Share folders between the paired devices
Firewall rules
Open port 22000 for Syncthing sync traffic:
sudo ufw allow 22000/tcp
sudo ufw allow 22000/udpIf you use direct discovery (local LAN), also allow:
sudo ufw allow 21027/udpReverse 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
| Command | Description |
|---|---|
systemctl restart syncthing@$USER | Restart the service |
systemctl status syncthing@$USER | Check service status |
journalctl -u syncthing@$USER -f | Live logs |
syncthing --version | Check version |
Upgrade
sudo apt update && sudo apt upgrade syncthing -y