Setting web GUI port for syncthing -- multiple users on single host w/ systemd

I found these instructions very helpful for setting up syncthing for multiple users on a single host using systemd.

I used the following to add the systemd files for each user on an ubuntu machine:

sudo systemclt enable syncthing@alice
sudo systemctl enable syncting@bob
sudo systemclt start syncthing@alice
sudo systemctl start syncthing@bob

This works great. Syncthing starts and all of the other devices find the linux machine and start syncing.

I’m a little baffled how to set the port for the Web GUI or alternatively, how to find the ports other than digging through the systemd journal. Is there a simple way to do this?

I’m just learning about how systemctl unit templates work. As far as I can tell systemctl enable syncthing@bob makes a symlink from /etc/systemd/system/multi-user.target.wants/syncthing@bob.service → /lib/systemd/system/syncthing@.service

I know that I can use -gui-address="192.168.1.10:8384" in the unit file, but how can I do this when the file is symlinked? In this case both Bob and Alice will get the same values. This obviously will cause problems as both Bob and Alice will presumably have the same port.

Thanks for the help

The way I did this a while ago was by doing the initial startup “by hand”, using the command line option to override. Then, I configured different listen addresses via the GUI, saved the settings, exited syncthing and then used systemd afterwards.

Thanks for that tip. I ended up just locating the individual users ~/.config/syncthing/config.xml and editing the <address> key to allow local network connections and match the desired port for each user.

<gui enabled="true" tls="false" debugging="false">
    <address>0.0.0.0:8385</address>
    <apikey>abc123</apikey>
    <theme>default</theme>
</gui>
1 Like

Setting it in config seems like the right way to go. If you for some other reason need to make user specific (or not) changes to systemd units, you can either do this manually using .d config directories (e.g. /etc/systemd/system/syncthing@bob.service.d/override.conf) or simply calling systemctl edit syncthing@bob which will create a file in the appropriate location directly.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.