I’ve just set up synchronisation of /home on Kubuntu 20.04 using v1.16.1 and I notice that any newly created files are created as root!
How can I overcome this without having to teach every user how to use Syncthing and then support them when they mess it up? I just want to be the one to set this up for them without having to log in as them.
Anyway the more involved bit will be managing the various configurations. Depending on what your actual setup/use-case is, using some config management solution might be a good idea (e.g. ansible). Can’t comment further without knowing more about that.
Actually I already read that information before choosing to it use system.d as root because if run as a user there are two major issues:
If the user doesn’t log in on PC1 for 2 weeks but uses PC2 instead, his home directory will not be updated on PC1, which is the master copy which is backed up to a NAS every hour.
As you mentioned trying to configure the syncronising for each user becomes significantly harder and monitoring the result for each user simply won’t even happen!
In the absence of a reasonable solution I propose to just add a cron script to run every 5 minutes, which will change the ownership of all files in each users home directory, back to the ownership of that user. My understanding is that only newly added files will be affected and I can’t think of any downsides.
Thanks for your inputs by the way and your fast responses. What do you think of my workaround? Any major issues?
Issue 1 is only relevant for user services, system services always run for every user even without login, not only if it is running as root. Just do the steps in the documentation under “How to set up a system service” for every user.
Issue 2 still remains with this solution since one instance is running for every user.
Thanks Alex. It turns out that a system service is what I’m currently using.
I specified root as the user and this is resulting in all newly transferred files being owned by root.
All other issues are no issue though since all home directories are syncronised regardless of who is logged on and I can also monitor all directories in one screen using the web GUI.
So it’s just ownership which is the issue. It would be a nice touch if as well as the “ignore permissions” option (which I’m not using), there was another box for “maintain ownership”. That would be fantastic.
The user ID’s match on all machines, so translation would not be necessary (but would be a nice touch probably for some people if it could do that too).
It’s looking like I’m going to be needing a chown -R script I think?