$linuxjunkies
>

Install Syncthing for Peer-to-Peer File Sync

Install Syncthing on Linux, run it as a systemd service, pair devices by ID, configure shared folders, and control what gets synced with ignore patterns.

BeginnerUbuntuDebianFedoraArch9 min readUpdated June 7, 2026

Before you start

  • A regular (non-root) user account with sudo access
  • systemd running as the init system (default on all major distros)
  • At least two devices to sync between (or one device for testing the service)
  • Basic familiarity with a terminal and a text editor

Syncthing keeps folders in sync across your machines without a cloud middleman. It's open-source, encrypted in transit, and runs entirely on your own hardware. This guide covers installation on the three major distro families, wiring it up as a proper systemd service, pairing devices, configuring shared folders, and excluding files you don't want synced.

Install Syncthing

Debian / Ubuntu

The official Syncthing APT repository is the right choice here — the version in Ubuntu's default repos often lags by several releases.

sudo mkdir -p /etc/apt/keyrings
curl -L -o /tmp/syncthing-release-key.gpg \
  https://syncthing.net/release-key.gpg
sudo gpg --dearmor -o /etc/apt/keyrings/syncthing-archive-keyring.gpg \
  /tmp/syncthing-release-key.gpg
echo "deb [signed-by=/etc/apt/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

Fedora / RHEL / Rocky

Syncthing is in the standard Fedora repos and in EPEL for RHEL-family systems.

# Fedora
sudo dnf install syncthing

# RHEL 9, Rocky 9 — enable EPEL first
sudo dnf install epel-release
sudo dnf install syncthing

Arch Linux

sudo pacman -S syncthing

Run Syncthing as a systemd User Service

Running Syncthing under your own user account (not root) is the correct approach for desktop syncing. Systemd's user instance handles this cleanly and starts Syncthing at login without any special privileges.

systemctl --user enable --now syncthing

To make the service start even when you're not logged in — useful on a home server or always-on laptop — enable lingering for your account:

sudo loginctl enable-linger $USER

Check that it came up cleanly:

systemctl --user status syncthing

Output will show active (running) and the PID if everything is healthy.

Access the Web UI

By default the web interface listens only on localhost port 8384. Open a browser and go to:

http://127.0.0.1:8384

On first launch Syncthing will prompt you to set a GUI username and password. Do this immediately — especially if the machine is reachable from other hosts. Go to Actions → Settings → GUI and fill in the credentials.

If you need to reach the UI from another machine on your LAN, change the GUI Listen Address to 0.0.0.0:8384 in that same settings panel, then restart the service. Restrict access with your firewall if you do this.

Find Your Device ID and Add Remote Devices

Every Syncthing instance has a unique 63-character Device ID derived from its TLS certificate. You'll exchange these IDs to pair machines.

From the web UI: click Actions → Show ID. You can also get it from the terminal:

syncthing --device-id

Copy this ID and send it to the person (or yourself on the other machine) who needs to add you.

Adding a Remote Device

  1. Click Add Remote Device in the bottom-right of the web UI.
  2. Paste the remote device's ID into the Device ID field. Syncthing will auto-format it.
  3. Give the device a friendly name (e.g., laptop, nas).
  4. Click Save.

The remote device must also add yours before the connection is established. Syncthing shows a pending notification banner when the other side has added you, making it easy to accept from either end.

Set Up a Shared Folder

Syncthing creates a default folder at ~/Sync. You can add any directory on your system.

  1. Click Add Folder on the left panel of the web UI.
  2. Set a Folder Label (human-readable name) and the Folder Path (absolute path on disk, e.g., /home/alice/Documents/Projects).
  3. Under the Sharing tab, tick the devices you want to share this folder with.
  4. Choose a Folder Type:
    • Send & Receive — full bidirectional sync (the default; use this in most cases).
    • Send Only — local changes propagate out, remote changes are ignored. Useful for a master source machine.
    • Receive Only — acts as a backup target; local changes are not pushed back.
  5. Click Save.

The remote device will receive a share request notification. Accept it there, choosing a local path on that machine. Syncthing then begins the initial index scan and starts transferring differences.

Configure Ignore Patterns

Syncthing reads a file called .stignore in the root of each synced folder. Patterns here follow a gitignore-style syntax and are evaluated per-folder.

Create or edit the file directly:

nano ~/Sync/.stignore

Useful patterns to consider:

# Temporary files
*.tmp
*.swp
*~

# macOS metadata (if sharing with Mac users)
.DS_Store

# Thumbnail caches
Thumbs.db
.thumbnails

# Build output directories
build/
dist/
node_modules/

# Include patterns from a shared file (useful for teams)
#include .stignore-shared

Pattern rules to know:

  • A leading / anchors the match to the folder root (e.g., /build/ won't match src/build/).
  • A trailing / matches directories only.
  • ! prefix negates a pattern (include something that was excluded by an earlier rule).
  • (?i) prefix makes the rest of the pattern case-insensitive.

Changes to .stignore take effect at the next rescan. Force an immediate rescan from the web UI by clicking Rescan next to the folder, or from the terminal:

curl -s -X POST -H "X-API-Key: YOUR_API_KEY" \
  http://127.0.0.1:8384/rest/db/scan?folder=FOLDER_ID

Find your API key under Actions → Settings → GUI → API Key.

Verify Sync Is Working

The web UI dashboard is the easiest place to confirm health. Each folder shows one of these states:

  • Up to Date — everything is in sync.
  • Syncing — transfer in progress, with a progress percentage.
  • Out of Sync — differences detected but not yet resolved (click the folder for details).
  • Scan Error / Sync Error — a file could not be read or written; the error message will point to the cause.

From the command line, query the API:

curl -s -H "X-API-Key: YOUR_API_KEY" \
  http://127.0.0.1:8384/rest/db/status?folder=FOLDER_ID | python3 -m json.tool

Look for "state": "idle" when the folder is fully synced.

Troubleshooting

Devices Can't See Each Other

Syncthing uses the global discovery server and relay servers by default, so direct LAN visibility isn't required. If two devices are on the same LAN and you want to avoid relays, ensure both have Local Discovery enabled under Actions → Settings → Connections. UDP port 21027 must not be blocked between them.

For direct connections (faster, no relay), TCP port 22000 should be open or at least not blocked by the local firewall. Check your firewall rules:

# ufw (Ubuntu/Debian)
sudo ufw allow syncthing

# firewalld (Fedora/RHEL)
sudo firewall-cmd --permanent --add-service=syncthing
sudo firewall-cmd --reload

Service Fails to Start

Inspect the journal for the user service:

journalctl --user -u syncthing -n 50

A common cause is a stale lock file. Stop the service, remove ~/.local/state/syncthing/index-v0.14.0.db.lock if present, then restart.

Folder Shows "Out of Sync" Permanently

Click the folder in the UI and look at the Out of Sync Items list. Permission errors and filesystem case-sensitivity conflicts (syncing between Linux and macOS/Windows) are frequent culprits. Receive Only folders will always show local changes as "out of sync" — that's expected behaviour.

tested on:Ubuntu 24.04Debian 12Fedora 40Arch rolling

Frequently asked questions

Does Syncthing store my files on any external server?
No. Your files transfer directly between your devices. Syncthing uses its global discovery and relay servers only to help devices find each other and to relay encrypted traffic when a direct connection isn't possible — the relay servers never see the unencrypted content.
Can I sync between Linux, Windows, and macOS?
Yes. Syncthing is cross-platform. Be aware of filesystem differences: Linux is case-sensitive while Windows and macOS are not by default, which can cause conflicts with files that differ only in case. Use the .stignore file to handle OS-specific metadata like .DS_Store or Thumbs.db.
What happens if I edit the same file on two devices at the same time?
Syncthing detects the conflict and keeps both versions. The losing version is renamed with a .sync-conflict timestamp in the filename, placed next to the original. You must resolve conflicts manually — Syncthing does not attempt to merge file contents.
How do I run Syncthing on a headless server without a browser?
The systemd user service works fine headlessly once lingering is enabled with 'loginctl enable-linger'. Configure it via the web UI from another machine by binding the GUI to 0.0.0.0:8384, or use SSH port forwarding: 'ssh -L 8384:127.0.0.1:8384 user@server' and then browse to localhost:8384.
Will Syncthing keep deleted files recoverable?
Enable the Versioning feature per folder under the folder's Edit dialog. Options include Simple (keep N old copies), Staggered (time-based retention), and External (hand off to a custom script). Without versioning, deletions propagate to all devices.

Related guides