Folder-specific ownership policy

Is there a way to set an ownership policy in a folder-specific way? I would like to sync both my documents folder (owned by waltmck:users) and some system folders in /var/lib (owned by root:root). I want new files in each to be created with the respective permissions of their parent directory.

Note that this is different from syncing ownership, which I do not want (my documents folder has different ownership on different devices). I also realize that this could be accomplished by running multiple parallel instances of syncthing as different users, but this is wasteful as it duplicates peer finding effort and configuration.

EDITED TO ADD: See downthread, looks like I missed the mark on this.

Syncthing does not do this.

If a Syncthing Device receives ownership information on a file (Folder/Edit/Advanced options of Sync Ownership and Send Ownership), it will try to match it POSIX-to-POSIX and Windows-to-Windows. Syncthing doesn’t have the rights to change ownership on a file unless the user that owns the process has those rights.

If you don’t use one of those options, the user that owns the Syncthing process will own synced files.

I am willing to run syncthing as root, so rights to change ownership is not an issue. Obviously you are correct that Syncthing cannot do something that the ACL doesn’t allow it to do.

Is there any particular reason that this isn’t a feature when syncing ownership (a much more difficult problem) is supported? Or is this just one of those things that nobody has gotten around to implementing?

I am not part of the Syncthing team and I do not speak for them; I do not know why this feature hasn’t been implemented. For myself I expect that syncing ownership of a file is a bit of a simpler feature: There’s not much needed in the UI, and it either reads ownership of a file and tries to write it at the other end, or not.

I can’t find any posts on this subject before – I think you’re the first person who has asked for this feature.

Unless I’m misunderstanding something (which is very well possible, as I don’t use the feature), isn’t https://docs.syncthing.net/users/config#config-option-folder.copyownershipfromparent precisely what you want?

3 Likes

That’s fantastic, thank you!

Is it possible to make this the default behavior for new files? It doesn’t look like there is a GUI for this option so every time I set up a new device I will need to edit the config.xml in several places.

You can find it in the GUI in Actions → Advanced. You can also set it as the default for new folders.

3 Likes

As far as I know nobody has ever asked for this, never mind volunteered to implement it. :slight_smile:

1 Like

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