Ubuntu Server 18.04

I’m running syncthing on a headless Ubuntu Server. I do all work on this server via SSH from my local PC on the same home network. The problem I’m having is syncthing only works while the SSH tunnel is active.

Here’s how I set the server up:

  1. Installed using the debian repo at https://apt.syncthing.net/
  2. Followed instructions at DigitalOcean to enable remote viewing of the GUI. (changed GUI listen address to 0.0.0.0:8384)
  3. Set up syncthing as a service to autostart on system boot by executing commands:
    • systemctl --user enable syncthing.service
    • systemctl --user start syncthing.service
  4. Accessed GUI from my local PC by going to (server ip):8384. Set GUI authentication with username and password. Checked https box.
  5. Added peer and sync folders.

All of this was done with the SSH tunnel open, either directly with the command line, or through the GUI on my local browser. All of the syncing works fine while the tunnel is open. Once I end the SSH session, sync stops and I can no longer access the GUI from my local PC. How can I make this work independent of SSH?

This doesn’t add up, if you accessed syncthing by server ip:8384, then you are not using the tunnel. What’s most likely happening is that you run syncthing from the shell (rather as a service) which gets killed when you kill your ssh connection. Or your home directory gets encrypted when you log off which causes syncthing to crash. You should check syncthings logs.

1 Like

You did not set up syncthing as a service to autstart on system boot with those commands. The --user services are started on user login and terminated on logout (Starting Syncthing Automatically — Syncthing documentation). What you really want is systemctl enable/start syncthing@*replaceWithUserName*, which will really run the service at boot under that user.

1 Like

Oh, ok. That would explain why I couldn’t access the service outside of an active SSH session. When I closed down the SSH tunnel, it stopped the service. I ran the correct commands and everything is working now. The service is running and I can access the GUI remotely without the SSH session.

For posterity, here are the commands I ran:

  • systemctl --user stop syncthing.service
  • systemctl --user disable syncthing.service
  • systemctl enable syncthing@myusername
  • systemctl start syncthing@myusername

I also rebooted to verify that everything still worked. Thank you for the help!

2 Likes

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