Install Syncthing for Automatic File Sync on VPS

Install Syncthing for Automatic File Sync on VPS

July 2026 · 7 min read

Syncthing is a free, open-source peer-to-peer file synchronization tool that keeps files in sync across multiple devices without relying on third-party cloud storage. Connections between devices are always encrypted with TLS, and only devices you've explicitly approved (trusted devices) can sync with each other. Setting up a VPS as a Syncthing relay node or sync hub provides an always-on sync point, ideal for devices outside your home network or facing NAT traversal issues.

Check System Compatibility

# Check OS and kernel
uname -a

# Check system architecture
dpkg --print-architecture

# Syncthing supports: amd64, i386, arm64, armv7l, armv6l

Download and Install Syncthing

Syncthing is available in multiple distribution packages. Here we'll use the pre-built binary for 64-bit Linux on Ubuntu/Debian:

# Create installation directory
mkdir -p ~/syncthing-install && cd ~/syncthing-install

# Download latest Syncthing (for amd64)
wget https://github.com/syncthing/syncthing/releases/download/v1.27.0/syncthing-linux-amd64-v1.27.0.tar.gz

# Extract the tarball
tar xzf syncthing-linux-amd64-v1.27.0.tar.gz

# Move binary to /usr/local/bin
sudo cp syncthing-linux-amd64-v1.27.0/syncthing /usr/local/bin/

# Make executable
sudo chmod +x /usr/local/bin/syncthing

# Verify installation
syncthing --version
Tip: Always check the GitHub releases page for the latest Syncthing binary before downloading to ensure you get the most recent version.

Create System User for Syncthing

# Create a new user without shell access
sudo useradd -r -s /bin/false -m -d /var/lib/syncthing syncthing

# Verify user was created
id syncthing

# Create directory for Syncthing configuration
sudo mkdir -p /var/lib/syncthing
sudo chown syncthing:syncthing /var/lib/syncthing
sudo chmod 700 /var/lib/syncthing

Set Up Systemd Service

To run Syncthing automatically and restart on failure, create a systemd unit file:

sudo nano /etc/systemd/system/[email protected]

Paste the following content:

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %i
After=network.target
Wants=syncthing-inotify@%i.service

[Service]
Type=notify
User=%i
Group=%i
ProtectSystem=full
PrivateTmp=true
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources
StandardOutput=journal
StandardError=journal
Restart=on-failure
RestartForceExitStatus=3 4
RestartSec=5
SuccessExitStatus=3 4
ExecStart=/usr/local/bin/syncthing -no-browser -gui-address=127.0.0.1:8384

[Install]
WantedBy=multi-user.target
# Reload systemd daemon
sudo systemctl daemon-reload

# Enable Syncthing for the syncthing user
sudo systemctl enable syncthing@syncthing

# Start the service
sudo systemctl start syncthing@syncthing

# Check status
sudo systemctl status syncthing@syncthing

Access the Web GUI

Syncthing includes a web interface running on port 8384:

# Verify the GUI is responding
curl -s http://localhost:8384 | head -10

# Or access from another machine using SSH tunneling
ssh -L 8384:localhost:8384 user@your-vps-ip
# Then open http://localhost:8384 in your browser
Tip: Never expose port 8384 publicly. Always use SSH tunneling or firewall rules to restrict access to the GUI.

Add Devices and Create Shared Folders

Once you access the Web GUI, you'll see your Device ID. To connect other devices (laptop, phone, etc.) follow these steps:

# 1. On each device, install Syncthing and find its Device ID

# 2. In your VPS Web GUI
#    - Click "Add Remote Device"
#    - Paste the Device ID from the other device
#    - Save

# 3. On the other device
#    - Accept the connection from your VPS
#    - Select folders to share

# 4. Click "Share" in your VPS GUI to set up folder synchronization

Configure Firewall (if needed)

# Syncthing uses these ports:
# 22000/tcp - device-to-device communication
# 22000/udp - same
# 21064/udp - discovery

# If using UFW firewall
sudo ufw allow 22000/tcp
sudo ufw allow 22000/udp
sudo ufw allow 21064/udp

# Check firewall status
sudo ufw status

Verify That Syncthing Is Working Correctly

# Check service status
sudo systemctl status syncthing@syncthing

# View service logs
sudo journalctl -u syncthing@syncthing -n 50 --no-pager

# Verify the GUI is responding
curl -s http://localhost:8384 | grep -i syncthing | head -1

# Check which ports are listening
sudo ss -tuln | grep 8384
Tip: If Syncthing becomes unresponsive, restart the service with sudo systemctl restart syncthing@syncthing and check the logs for any errors.

Common Issues & Troubleshooting

Error: "Accepting connection from untrusted device"

You're attempting to connect from an unapproved device. Check the Device ID in your VPS Web GUI. If it's your device, click "Allow" in the GUI pop-up.

# View logs to see which devices are attempting connection
sudo journalctl -u syncthing@syncthing | grep "untrusted"

Error: "Folder contents differ" or Conflict Files

This happens when the same file is edited simultaneously on different devices. Syncthing creates ".sync-conflict" files.

# Find conflict files
find /var/lib/syncthing -name "*.sync-conflict*"

# Decide which version you want and delete the conflict file
# Or enable "File Versioning" in the GUI to keep old versions

Error: "Connection refused" or Devices not discovering

Devices can't find each other due to firewall or NAT issues. Verify ports are open and relay servers are functioning.

# Check relay status
curl -s http://localhost:8384/rest/system/status | grep -i relayStatus

# Check logs for discovery and relay warnings
sudo journalctl -u syncthing@syncthing | grep -i "discovery\|relay"

Web GUI not accessible from other machines

By default, the GUI only listens on localhost. Use SSH tunneling to access from other machines:

# On your client machine
ssh -L 8384:127.0.0.1:8384 user@your-vps

# Or edit config.xml to listen on 0.0.0.0 (less secure)
sudo nano /var/lib/syncthing/.config/syncthing/config.xml
# Find <gui enabled="true" tls="false"><address>127.0.0.1:8384</address>
# Change 127.0.0.1 to 0.0.0.0 (local network only, not internet-facing)

Syncthing using high CPU or slow disk I/O

May be due to syncing large numbers of files or inotify limit being too low.

# Check what files are being processed
sudo journalctl -u syncthing@syncthing | grep -i "scan\|syncing"

# Increase inotify limit for syncthing user
sudo -u syncthing sh -c 'echo "fs.inotify.max_user_watches = 524288" | sudo tee -a /etc/sysctl.conf'
sudo sysctl -p

# In the Web GUI, open Settings > Options and adjust Rescan Interval if needed

Frequently Asked Questions

Is Syncthing secure?

Yes. Syncthing encrypts all device-to-device communication with TLS and only connects to devices whose Device ID you've explicitly approved. The project has undergone independent third-party security audits before (a Cure53 audit in 2018). That said, synced files are still stored as plain files on each destination device by default — it's not zero-knowledge encryption unless you enable "Untrusted Device" mode, which encrypts files before they're stored.

Will Syncthing consume a lot of internet bandwidth?

It depends on the number of files and frequency of changes. Small configuration or document files use minimal bandwidth. Large video or database syncing may consume significant bandwidth. You can set a folder's Folder Type to "Send Only" or "Receive Only" instead of "Send & Receive" to control sync direction and cut unnecessary transfers.

Can I run Syncthing for multiple user accounts?

Yes, but each user account needs its own service unit, such as syncthing@user1 and syncthing@user2. Each service maintains separate configuration and settings.