sudo chown "Operation not permitted" - how to resolve permissions to allow chown by admin or root users?
As sanity check I was sudo chown
ing some folders due to having run some commands previously that generated some root
owned files in my $HOME
. I ended seeing an error in this process that got me curious:
chown: Library/Caches/com.mailplaneapp.Mailplane3/[email protected]/Downloads/151623a0c45f2b4_0.1.pdf: Operation not permitted
ls -l@ Library/Caches/com.mailplaneapp.Mailplane3/[email protected]/Downloads/151623a0c45f2b4_0.1.pdf
doesn't reveal anything overly remarkable in this regard:
-rw-r--r--@ 1 USERNAME staff 335080 Aug 17 2018 Library/Caches/com.mailplaneapp.Mailplane3/[email protected]/Downloads/151623a0c45f2b4_0.1.pdf
com.apple.metadata:kMDItemWhereFroms 284
I noticed this same thing from other files in this folder. Is there something I can do to strip whatever permissions might be preventing an admin / root user from modifying ownership via chown
?
Try either or both of these commands:
sudo chflags noschg '/path/to/file.ext'
sudo chflags nouchg '/path/to/file.ext'