For security reasons, configure a firewall to limit connections to Syncthing’s GUI port if the username and password aren’t sufficiently hard to guess.
As for SSH tunneling, the command-line syntax is really straight forward. If you’re using OpenSSH for Linux, macOS or Windows:
ssh -L <local_port>:<server_address>:<server_port> <remote_address>
So, to avoid conflicting with a local instance of Syncthing, if you choose local port 48384 for one end of the SSH tunnel, keep Syncthing’s default of 127.0.0.1:8384
on your VPS, and your VPS is located at IP address 1.2.3.4
:
ssh -L 48384:127.0.0.1:8384 1.2.3.4
Then fire up a local web browser and point it at http://127.0.0.1:4834/
You can also get fancy with a desktop shortcut, using PuTTY, or some other compatible SSH client with a GUI.
Ubuntu 22 – I’m guessing it’s 22.04 LTS – ships a fairly dated version of Syncthing (1.18.0), but whether you’re using Ubuntu’s repo or Syncthing’s repo, both packages already bundle a ready-to-use systemd unit file, so no need to add one from Syncthing’s Git repo.
In an earlier post, you mentioned using the command systemctl status syncthing@myuser.service
but had also said that you’re temporarily running Syncthing as root
for your initial setup, so I’m assuming the “myuser” wasn’t literal. But if it was literal, it explains the line from the output you posted:
Loaded: loaded (/etc/systemd/system/syncthing@.service; disabled; preset: enabled)
The output above says “disabled;”, meaning that either the service hadn’t been enabled, or there was no matching service enabled.
Although systemd can have a fairly steep learning curve for users coming from init, RC or Upstart, majority of the time just a handful of commands are all that’s needed: enable, disable, start, stop, status.
It takes at most two steps to enable a service for autostart, and to start it immediately without a reboot:
systemctl enable syncthing@root.service
systemctl start syncthing@root.service
Can also combine steps 1 + 2 in a single shot:
systemctl --now enable syncthing@root.service
Using enable
is only required if you want systemd to autostart the service at system boot. Otherwise start
and stop
can be used any time either manually, via a cron job, etc.
Service status check:
systemctl status syncthing@root.service
At this point, the syntax for stop
and disable
hopefully should be obvious.
Upstart was discontinued just over 10 years ago (Sept 4, 2014), so it’s not going to be available in the newer official Ubuntu releases.
Don’t give up on systemd just yet – it’s really much easier than it seems.
I have two recommendations:
- Remove the
syncthing@.service
systemd unit file you got from the Git repo to avoid confusion with the ones bundled with Ubuntu and Synthing’s DEB packages.
- Before installing a systemd unit downloaded from somewhere on the internet, always review the list of services that are already installed via the following command:
systemctl --type=service
It’s rare for network services software intended for a Linux system running systemd to not bundle a service unit file. And even when it is, one of the existing unit files can be used as a template for a custom one as needed.
Unless you’re frequently rebooting your VPS, a manual start isn’t a bad idea.
On my server, I autostart Syncthing on a time delay (i.e. via a separate syncthing.timer
unit file) to allow any boot time filesystem repairs or other tasks to do their thing first.