Change Syncthings .config directory

Hello together,

I am hosting Syncthing on a webserver, and the service is started as the www-data user. The home-directory of www-data is /var/www/, so Syncthings configuration folder is /var/www/.config/. Now, I want to change the path of /var/www/.config/ to /var/www/xy/.config/. The only information I coud find is Right at the beginning it says:

The location defaults to $HOME/.config/syncthing (Unix-like), $HOME/Library/Application Support/Syncthing (Mac), or %LOCALAPPDATA%/Syncthing (Windows). It can be changed at runtime using the -home flag.

I don’t exactly understand how to use this “-home flag”, can someone help me?

  • Nick

syncthing -home /var/www/xy/.config/syncthing

Thank you for the fast reply!

But I didn’t install Syncthing with a normal package manager (because the ubuntu repo is to old), but manually, so I don’t have the option to run Syncthing-commands. Is there any alternativ?

Alter the command however/wherever you start it. If you’re looking for an up to date Debian package, you can use

And is it possible to change the default path without an installed Syncthing instance?

I don’t really understand what you mean, but no, Syncthing has a default which is ~/.config/syncthing. To use something else, you give it the corresponding command line option.

Ok, so it isn’t possible to change the path in a configuration file for example. So I MUST install it (in this case) via apt to change the Path?

The path in question is the one to the configuration file. You can’t change it in a config file, because we need to know the path to find the config file to begin with.

Whether you installed via APT or just a .tar.gz from GitHub has no bearing on this.

My actual problem is that running ‘syncthing -home /var/www/xy/.config/’ brings this error:

nick@ubuntu-server: syncthing -home /var/www/xy/.config/syncthing
Command 'syncthing' not found, but can be installed with:
sudo apt install syncthing

And it gives you the solution… install syncthing…

Ok, thanks a lot!

I’ll try it.


Why do you try to run syncthing with user nick, although you want to change the config dir for user www-data?

How is syncthing started for user www-data?

Oh, I didn’t notice that!

That’s how I installed and started Syncthing:

cd /tmp/ && wget && tar -xf syncthing*.tar.gz && sudo mkdir /opt/syncthing && sudo mv syncthing*/syncthing /opt/syncthing/

sudo chown -R www-data:www-data /opt/syncthing/ && cd && sudo chown -R www-data:www-data /var/www/ && sudo editor /etc/systemd/system/syncthing@.service && sudo systemctl enable --now syncthing@www-data

Edit: Running the command with the www-data user fails too:

nick@ubuntu-main-server:~$ sudo -u www-data syncthing -home /var/www/xy/.config/syncthing sudo: syncthing: command not found

So you did this 1.5 years ago (according to the version) and just now want to change the config dir?

Regardless, as it seams you edited the service file to change the path to syncthing (as it is not “installed” or placed in a path inside the PATH variable; thats why just running syncthing doesn’t work) you know where to set the -home cli option. It must not be just run once but every time syncthing is started, you have to tell it where the config/home dir is.

That’s the service file:


Description=Syncthing - Open Source Continuous File Synchronization for %I


[Service] User=%i

ExecStart=/opt/syncthing/syncthing -no-browser -no-restart -logflags=0


SuccessExitStatus=3 4

RestartForceExitStatus=3 4


No, I don’t now(?)

Here, among the other flags.

I added -home=/var/www/xy, restarted the daemon and Syncthing is working fine now.

Thank you all very much for the help and your patience! ⠀ ⠀

Sometimes you miss the forest for the trees

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