Running Syncthing as windows service

I am trying to use a service for syncthing in MS Windows/Windows server.

I can successfully install and start the service - but once started I cannot stop/pause/resume/shutdown.

I have tried using the restapi connections - no dice. I tried to use the cli - no dice. when I start it standalone everything works fine. Once installed as a client and started - all I get is CSRF errors (commandline cli shutdown and postman) - using the exact url with the same key as before.

I have tried using an http client in the service and calling the cli and get the same results (CSRF error). I am using a “vanilla” install so the config files are all in the default locations.

We have a hard requirement to use this as a service - so on startup will not work.

I have written the service wrapper in C# which basically creates a process, but once created is seems to be “silent” to the rest api - I can however connect to the default port (8384) and get the normal page.

At a guess, you’re running it as a different user and it gets a different config and hence different API key.

This is true - it is using the localservice - would you know where the config file might be?

C:\Windows\ServiceProfiles\LocalService\AppData\Local\Syncthing This is the location and it does indeed use a different key

1 Like

I would run it as a user via TaskSched. on Computer start. If it can be a non-admin better :wink:

Thanks everyone - the simple thing was the correct answer - it was running under a different user - that solved everything.

The docs on running as a Windows service may also be useful.

1 Like

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