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.
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.)
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.
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.