Skip to main content

Install Syncthing

Multiple instances are possible, but for user- and hostnames only “syncthing”, “syncthing2” to “syncthing9” are allowed. Further adoptions needed

  • Username
  • Datasetname and ownage (chown)
  • .service file
    • User=
    • –home
    • –gui-address increase port by one

Install syncthing

apt install curl apt-transport-https ca-certificates
curl -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | tee /etc/apt/sources.list.d/syncthing.list
apt update
apt install syncthing

Create and adopt this file for every instance you want /etc/systemd/system/syncthing.service

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for syncthing
Documentation=man:syncthing(1)
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=4

[Service]
User=syncthing
ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0 --home=/poolname/syncthing --gui-address=0.0.0.0:8384
Restart=on-failure
RestartSec=1
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

# Hardening
ProtectSystem=full
PrivateTmp=true
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true

# Elevated permissions to sync ownership (disabled by default),
# see https://docs.syncthing.net/advanced/folder-sync-ownership
#AmbientCapabilities=CAP_CHOWN CAP_FOWNER

[Install]
WantedBy=multi-user.target

Copy /etc/systemd/system/syncthing to the ZFS pool:

mkdir /customerid/lxcbackups/systemd
cp -a /etc/systemd/system/syncthing /customerid/lxcbackups/systemd/
systemctl daemon-reload
systemctl start syncthing.service
systemctl status syncthing.service