Skip to content

modstart-lib/syncthing-relaysrv-ctl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Syncthing Relay Server Deployment Script

English | 简体中文

Bash script for automated deployment of Syncthing Relay Server v2.0.13, supporting multiple Linux distributions.

Features

  • ✅ Auto-detect system architecture (amd64, arm64, arm, 386)
  • ✅ Support multiple Linux distributions (Ubuntu, Debian, CentOS, Fedora, Rocky Linux, AlmaLinux, Arch, Manjaro, openSUSE, Alpine)
  • ✅ Support systemd and OpenRC service management
  • ✅ One-click install and uninstall
  • ✅ Optional relay token configuration (auto-generate 32-char token if empty)
  • ✅ Auto-create systemd/OpenRC service
  • ✅ Auto-start on boot
  • ✅ Log management

Requirements

  • Linux operating system
  • Root privileges (use sudo)
  • systemd or OpenRC service manager
  • Network connection (for downloading files)

Usage

Installation

  1. Download the script:
wget https://raw.githubusercontent.com/your-repo/syncthing-relaysrv-ctl/main/relaysrv-ctl.sh
chmod +x relaysrv-ctl.sh
  1. Run the install command:
sudo ./relaysrv-ctl.sh install
  1. Enter relay token when prompted (optional, leave empty to auto-generate a 32-char random token)

Uninstallation

sudo ./relaysrv-ctl.sh uninstall

During uninstallation, you'll be asked whether to delete configuration files and logs. The script itself will not be deleted.

Help

./relaysrv-ctl.sh help

Installed File Locations

File/Directory Path
Binary file /usr/local/bin/strelaysrv
Symlink /usr/local/bin/relaysrv
systemd service /etc/systemd/system/syncthing-relaysrv.service
Config dir /etc/syncthing-relaysrv/
Config file /etc/syncthing-relaysrv/config
Log dir /var/log/syncthing-relaysrv/

Common Commands

systemd Systems (Most modern Linux distributions)

# Check service status
sudo systemctl status syncthing-relaysrv

# View real-time logs
sudo journalctl -u syncthing-relaysrv -f

# Restart service
sudo systemctl restart syncthing-relaysrv

# Stop service
sudo systemctl stop syncthing-relaysrv

# Start service
sudo systemctl start syncthing-relaysrv

# Disable auto-start on boot
sudo systemctl disable syncthing-relaysrv

# Enable auto-start on boot
sudo systemctl enable syncthing-relaysrv

OpenRC Systems (Alpine Linux)

# Check service status
sudo rc-service syncthing-relaysrv status

# Restart service
sudo rc-service syncthing-relaysrv restart

# Stop service
sudo rc-service syncthing-relaysrv stop

# Start service
sudo rc-service syncthing-relaysrv start

Configuration

Modify Token

Edit the configuration file:

sudo nano /etc/syncthing-relaysrv/config

Modify the TOKEN value, then restart the service:

sudo systemctl restart syncthing-relaysrv

View Logs

# View real-time logs (systemd)
sudo journalctl -u syncthing-relaysrv -f

# View log files
sudo tail -f /var/log/syncthing-relaysrv/relaysrv.log
sudo tail -f /var/log/syncthing-relaysrv/relaysrv-error.log

Supported Architectures

  • x86_64 (amd64)
  • aarch64/arm64
  • armv7l (arm)
  • i386/i686 (386)

Supported Linux Distributions

  • Ubuntu / Debian
  • CentOS / RHEL / Rocky Linux / AlmaLinux
  • Fedora
  • Arch Linux / Manjaro
  • openSUSE
  • Alpine Linux

Security Features

The service is configured with the following security restrictions:

  • NoNewPrivileges=true - Prevent privilege escalation
  • PrivateTmp=true - Private temporary directory
  • ProtectSystem=strict - Read-only system directories
  • ProtectHome=true - Protect home directories
  • Configuration file permissions set to 600

Troubleshooting

Service Fails to Start

  1. Check service status:
sudo systemctl status syncthing-relaysrv
  1. View detailed logs:
sudo journalctl -u syncthing-relaysrv -n 100 --no-pager

Port Already in Use

By default, the relay server uses port 22067. If the port is already in use:

sudo lsof -i :22067

Download Failed

If the download fails, it may be due to network issues or restricted GitHub releases access. You can try:

  1. Check network connection
  2. Use a proxy
  3. Manually download the file and place it in /usr/local/bin/strelaysrv

License

MIT License

Related Links

About

syncthing relaysrv installer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages