User & Gruppe anlegen:
groupadd --gid 972 syncthing-relaysrv
useradd --uid 972 --gid 972 --no-create-home syncthing-relaysrv --root / --shell /usr/sbin/nologin --home /
mkdir /var/lib/syncthing-relaysrv/
chown 972:972 /var/lib/syncthing-relaysrv/
Zu Kontrolle:
~$ grep syncth /etc/{group,passwd}
/etc/group:syncthing-relaysrv:x:972:
/etc/passwd:syncthing-relaysrv:x:972:972:Syncthing relay server:/:/sbin/nologin
~$ sudo ls -dl /var/lib/syncthing-relaysrv/
drwx------ 2 syncthing-relaysrv syncthing-relaysrv 4096 17. Okt 22:18 /var/lib/syncthing-relaysrv/
/usr/lib/systemd/system/syncthing-relaysrv.service:
[Unit]
Description=Syncthing relay server
After=network.target
[Service]
User=syncthing-relaysrv
Group=syncthing-relaysrv
#ExecStart=/usr/bin/strelaysrv -provided-by 'mjx2 Network' -pools '' -status-srv :22070 -listen :22067 -keys /var/lib/syncthing-relaysrv/
ExecStart=/usr/bin/strelaysrv -provided-by 'mjx2 Network' -status-srv :22070 -listen :22067 -global-rate 10240 -keys /var/lib/syncthing-relaysrv/
WorkingDirectory=/var/lib/syncthing-relaysrv
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
Service aktivierren und starten
sudo systemctl enable syncthing-relaysrv.service
sudo systemctl start syncthing-relaysrv.service