Syncthing with rsync not preserving ownership

I rsync a file structure from e.g. /home/fred/folder1 to e.g. /home/me/sync, where the latter is a Syncthing directory, and where the operation yields /home/fred/sync/home/fred/folder1 (sic). I have set rsync to preserve ownership, so the owner of /home/fred/sync/home is - remains - root. However, once Syncthing transfers /home/fred/sync/home to another computer, that directory (‘home’) ends up being the user under which Syncthing runs on that other computer - say, ‘Trish’. But I need that owner to remain root (because I then rsync it to the local filesystem).

What to do? I looked at this forum post and this issue but I understand them poorly - they’re too advanced for me. I hope that there is an answer, besides running Syncthing as root.

I suppose the short version of my query is as follows. I use Syncthing with rsync and Syncthing is not preserving ownership.

Please see:

The following are not synchronized;

  • File or Directory Owners and Groups (not preserved)

There are workarounds, like giving the process magical capabilities via linux capability subsystem etc, but these are all undocumented advanced features for power users.

Thank you. However: having spent months get my syncthing-with-rsync working - working apart from this problem - I’m not giving up now, especially since, for transferring stuff between my laptops, I really need this ability.

Would the following work? (I draw on this webpage.)

setfacl -m u:syncthingUser:rw /home/fred/NJ/Sync/Laptops

= Allow the user ‘syncthingUser’ full access to that folder (but only that folder).

setfacl -d -m u:syncthingUser:rw /home/fred/NJ/Sync/Laptops

= Give user syncthingUser full access to everything created in the folder.

And I will need (somehow) to run Syncthing as syncthingUser.

EDIT: I find that there is Syncthing-acl, but it is in alpha. Perhaps I’m better off not using Syncthing but rather the following procedure.

  1. Rsync my stuff to some folder (a non-Syncthing folder) using the script that does that and which I have already.
  2. SSH into the other machine.
  3. Rsync the stuff out, using another script I have already.

This has nothing todo with acls, acls are effectively permissions, they don’t permit changing ownership (ownership is not permissions).

Its probably easiest to run syncthing as the user you want to own the files.

Thanks, but since what I want is a partial mirror of my filesystem, the desired ownership varies by item. Also: the project I mentioned is designed to solve exactly my problem. Or so it seems to me. Perhaps I misunderstand.

Anyhow, I’ll go the SSH route.

Syncthing doesn’t sync ownership or groups - ever, no matter what permissions you grant it.

There is a feature to set ownership of synced items to the same as the parent directory. This does require root or a couple of capabilities to do the chown.

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