How to run syncthing by www:www

Goodaftertoon. I have two centos servers which are using syncthing. One is A,the other one is B. I created a file on A which is named bao.txt. Bao.txt is 【777 www:www】. but,when the file is synchronized to B,It becomes 【777 root:root】. In one word,the “User and Groups” is not be synchronized. The reason is that syncthing is running by root:root. How can I do to make syncthing runned by www:www???

That depends on how you start it. If you’re using something like systemd, it can be configured for what user to use. If you’re a script to launch it, you want something like su, sudo, setuidgid or chpst (programs from various different packages).

Don’t forget that when you change this, you also need to move and chown Syncthing’s config and database directory.

Thanks.

Nginx’s user can be configured in nginx.conf.As the screenshot,it is www www. IS there any way can configure Syncthing’s User in something like syncthing.conf?

Syncthing runs as the user that started it.

Thanks for your answer. I have already got the point:if I want to run syncthing by www:www,I must start it by www:www. But the problem is How can I start syncthing by www:www on centos 7?

I am sure google has the answer on how to launch applications as a different user.

Thanks,but I’m in china now,I can not access google.Could you please help me search the way launch applications as a different user on google?

This is how I do it on debian and ubuntu: sudo -u www /path/to/syncthing

but some chinese search engine could probably also give you some result for this… (I don’t know, but I assume there are people in china using linux :smiley: )

I find it simplest to start syncthing by crontab with @reboot. To have it run by www-data (which is the web server user on Ubuntu), I just added the line

@reboot /path/to/syncthing

to the crontab of www-data.

I placed a copy of the syncthing binary in a folder where www-data has write permission, so the auto-update works.

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