How to manage permissions of files owned by user “_unknown” in Mac OS 10.13.4

filesystemhigh sierrapermissionroot

I've got permissions problems with files on my MacOS 10.13.4 desktop.

When I try to correct the problems by hand, I see a curious issue:

Matt$ sudo chown Matt:Engineers TestFile
chown: TestFile: Operation not permitted

Matt$ ls -l
-rwx------ 1 _unknown  _unknown     24281 Jul 19 2016 TestFile

This file was copied as part of a large data transfer from another system with different users. However, chmod should still honor root authority, and even with an unknown user ID, should still allow root or a sudoer to change it.

Any ideas on this situation?

How can assert authority over this file, and correct its ownership and permissions?

Best Answer

I have found that 'chmod' is broken on 10.13.4, but 'cp', 'rm' and 'mv' are not.

That is, as a sudoer I can:

  1. use 'cp' to copy the file (I now own the copy)
  2. use 'rm' to remove the file with corrupted permissions
  3. use 'mv' to rename my copy as the original
  4. use 'chmod' and 'chown' to adjust ownership and permissions on the file.

It's a bit clumsy, but I can use a simple BASH script to fix one of these files, when I find it.