I have an application that complains about the permissions of its directory inside of /Applications. It wants to be set to 040775. I can fix it by running chmod 040775
, but I do not understand what the first 2 digits mean. Just running chmod 775
does not work, so apparently these first 2 digits are wrong. What are these 2 digits, and how can I view them in macOS? I'm looking for something like ls -l
. I'm running High Sierra.
MacOS – How to see 6-digit file permissions
macospermissionunix
Related Question
- MacOS – Flawed user permissions: cannot save files or open programs
- MacOS – SSH rejecting key file with extended attributes
- MacOS – Can’t create new directory in home folder: What are “default” permissions/ownership
- Has Unix directory usage or policy changed in High Sierra
- MacOS – What are all the available ACL attributes in Mac OS 10.13 High Sierra
- Understanding directory permissions in UNIX
Best Answer
The short answer is stat and ask for permissions field:
That application or instructions or memory is likely wrong. From the manual page, there are 4 digits in the octal representation for modes on macOS:
I've made a file conveniently named 040775 and applied permissions - you can see the 040 clears all sticky (as it’s 0775 part that matters), setUID, setGID bits so you get 0775 if you try to set 040775.
I've edited the above a bit and didn't do all the
stat
andls
but it should help you poke around at existing files and test out whether my experience that only the last 4 digits are interpreted as an octal bit mask to set permissions as documented in the chmod man page.