Technotes

Technotes for future me

Syncthing

Setting up a Syncthing Relay on Ubuntu Linux

Introduction

What is syncthing-relaysrv

syncthing-relaysrv is:

Syncthing is an application that lets you synchronize your files across multiple devices. This means the creation, modification or deletion of files on one machine will automatically be replicated to your other devices. Syncthing does not upload your data to the cloud but exchanges your data across your machines as soon as they are online at the same time.

Syncthing relies on a network of community-contributed relay servers. Anyone can run a relay server, and it will automatically join the relay pool and be available to Syncthing users.

This package contains the relay server binary: strelaysrv.

Installing syncthing-relaysrv

sudo 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" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt-get update
apt install syncthing-relaysrv

Create directory for certificates

sudo mkdir /etc/strelaysrv
sudo chown syncthing-relaysrv:syncthing /etc/strelaysrv

Create systemd script

vi /etc/systemd/system/strelaysrv.service
[Unit]
Description=Syncthing Relay Daemon
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=simple
User=syncthing-relaysrv
Group=syncthing
ExecStart=/usr/bin/strelaysrv -keys=/etc/strelaysrv -provided-by='blaataaps syncthing server'

PrivateTmp=true
#ProtectSystem=full
ProtectHome=true
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target

Enable and start strelaysrv

systemctl daemon-reload
systemctl enable strelaysrv.service
systemctl start strelaysrv.service
systemctl status strelaysrv.service

You should then see your syncthing relay pop up on here after a short time:
https://relays.syncthing.net/

More information can be found here and here

Last updated on 22 Nov 2022
Published on 16 Nov 2022
Edit on GitHub