2

First I tried cp -Rp to preserve ownership of copies files. That changed the ownership from root:wheel to myuser:staff. So then I tried rsync and ditto. All of these are supposed to preserve the ownership, but they do not. They change it to myuser:staff. All commands used with sudo.

For example:

sudo cp -Rp /sourcefiles/ /destfiles/

What am I missing?

1

Are you copying to a mounted volume that is on another system? If so, it may be confusing the uid and gid's.

Or are you copying to a NAS which might have an override setting for the ownership of the connected user. For example FreeNAS has options for NFS mounts to Mapall User and Mapall Group, and for AFP mounts to set default file and directory permissions

you can check for uid with something like
dscl . -read /Users/ UniqueID
and check for group id with
cat /etc/groups
or
dscacheutil -q group

Could you try tar'ing up a few files, copying them to the new volume and then untar'ing them and then check the file permissions?

  • The issue does not involve any other volumes. Everything is in normal directories on Macintosh HD. However, at this point I cannot reproduce the issue! When I copy using sudo as described in the original question, the file ownerships are preserved, as desired. As a check, copying the files without sudo changes the ownership to the logged in user. So at this point the mystery deepens, as when the problem originally occurred, I was able to reproduce the issue literally dozens of times, each time with sudo. It was as though the sudo was being ignored. – Jeffrey Simon Sep 6 '13 at 14:49
0

What you've described should work.

Perhaps the destination volume has the “Ignore ownership on this volume” flag set? (Get Info → Sharing & Permissions, does not apply to the startup disk)

  • Agreed. What I am seeing makes no sense, and "should not be happening". – Jeffrey Simon Sep 3 '13 at 21:54
  • I looked into Get Info > Sharing & Permissions and don't see any such flag, or even how you would set them. – Jeffrey Simon Sep 3 '13 at 21:56
  • It's a checkbox in Get Info for the volume containing the folder. (Note it can't be set on the startup disk.) – Kevin Reid Sep 3 '13 at 23:19
  • That clears that up! I am only using in this context the Macintosh HD, so there is no such checkbox, and that cannot be the problem! But good observation in case non-startup disks are involved. – Jeffrey Simon Sep 5 '13 at 0:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .