Root chmod operation not permitted on file
I am unable to add group write to a file on Mac OSX server using root. I'm guessing root on OSX is not really root then.
Does anyone know how I can proceed? Any operation on this file that requires privileged user fails.
server:WEBSITE root# whoami
root
server:WEBSITE root# chmod g+w PORe\ logo.jpg
chmod: Unable to change file mode on PORe logo.jpg: Operation not permitted
Solution 1:
Root is root, even on OS X Unix. That is why they disable it by default.
A quick google has shown that your file could be potentially locked. If you go and issue the command:
chflags nouchg /path/to/item
and then try your file again:
chmod g+w "PORe\logo.jpg"
This should allow you then to change things on that file specifically.
Make sure that your chmod switches are doing what you want them to do also. I experienced an issue whereby executing stuff on root would not do anything, but prepending my command with "sudo" did the trick, I then realised I had an issue with my root group in /etc/group.
If your root is like this: "root:x:0:" then it's ultimate root. (Note: Group 0 = root)
Below are a couple links that can provide you more information about chflags and the original source of this answer:
- http://ss64.com/osx/chflags.html
- https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/chflags.1.html
Original answer from post:
- http://forums.macrumors.com/showthread.php?t=1063440