0
votes

I'm trying to do an rsync between two machines over SSH (Source: macOS 10.11.6 -> Dest: macOS 10.12.4) and want to keep all mac specific attributes as well as permissions and ownership.

I have built and installed the lastest rsync (3.1.2) from source on both machines using the patches, fileflags, crtimes and hfs-compression.

I have modified /etc/sudoers on the destination machine and added: username ALL = (ALL) NOPASSWD: ALL and this seems to working fine as I'm not asked for password when using sudo. (I know I can limit this to only the rsync command but during debugging I'm using ALL here)

Executing:

rsync -avNHAXEx --safe-links --fileflags --protect-decmpfs --force-change --   progress --delete --rsync-path="sudo /usr/local/bin/rsync" --progress /path/to/src ssh_user@IP_of_dest:/path/to/dst

results in a correct sync aside from that the files have Posix owner 'ssh_user' instead of original owner on the destination machine.

A simple

rsync -av --rsync-path="sudo /usr/local/bin/rsync" /path/to/src ssh_user@IP_of_dest:/path/to/dst

also modifies the ownership and rsync pull executed with sudo on the destination machine gives the same result.

So, what am I missing here? Shouldn't -a and super rights on destination be enough?

1

1 Answers

0
votes

Answering this to have as future reference in case someone have a similar experience

After more debugging I think I have found an answer to this. rsync is performing as expected, the problem was that ssh_user and file_owner actually both had the same UID. listing files on the destination machine seriously confused me as these files where shown to belong to ssh_user. Using --numeric-ids and restoring the files back to the source machine gives the expected result.