Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Explain user permission numbers

Explain user permission numbers
Thread Tools
Mac Enthusiast
Join Date: Feb 2005
Status: Offline
Reply With Quote
Mar 28, 2005, 12:49 PM
 
Hi,

Could someone provide a quick explanation of the numbers associated with Users and Groups?

Sometimes when repairing permissions I will get a notice like:

User differs on ./Library, should be 0, owner is 501

I don't understand what the numbers like 0 and 501 mean...

I thought that permissions took the form of r w and x
     
Mac Elite
Join Date: Mar 2001
Location: Madison, WI
Status: Offline
Reply With Quote
Mar 28, 2005, 01:18 PM
 
I do not like those green links and spam.
I do not like them, Sam I am.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Mar 28, 2005, 03:28 PM
 
Originally posted by tightsocks:
User differs on ./Library, should be 0, owner is 501

I don't understand what the numbers like 0 and 501 mean...
In this case, they're user IDs. 0 is root and 501 is the first administrative account (you).
     
Mac Enthusiast
Join Date: Feb 2005
Status: Offline
Reply With Quote
Mar 28, 2005, 05:25 PM
 
Originally posted by Angus_D:
In this case, they're user IDs. 0 is root and 501 is the first administrative account (you).
Thanks for clarifying that.

Would it be considered bad form for an installer to leave a folder set as root?
     
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
Mar 28, 2005, 05:44 PM
 
Originally posted by tightsocks:
Would it be considered bad form for an installer to leave a folder set as root?
Depends on what folder it is.

A folder like /Library absolutely should be owned by root.

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
Posting Junkie
Join Date: Jun 2001
Location: Washington DC
Status: Offline
Reply With Quote
Mar 28, 2005, 07:48 PM
 
Originally posted by Macola:
All you wanted to know, and more:

http://www.gideonsoftworks.com/macosxprivileges.html
I think it would be useful to take it a little farther than that doc does. In particular, I think it's nice to know why read = 4, write = 2, and execute = 1.

It's because each of the three digits in the permissions number isn't actually a digit. It's an octet. Permissions are base-8 representations of binary strings.

Each digit is actually three bits, so 4 is 100, 2 is 010 and 1 is 001. When you starting thinking about binary as being ons and offs, it's easy to see how the permission numbers work. If you want read access to be on, you turn on the read bit and get 010. Then if you also want to be able to write you turn on the write bit and get 110. So the value of that octet is 6. Since there are three categories of users, owner, group, and world, you need three octets to fully define the permissions of a given file.

Personally, I find it much more intuitive to think about it as an octal representation of a binary string. Of course binary to octal and back conversions had to become second nature to me when I learned to program a PDP-8 using only the switches on the front as input, and the lights as output (damn, that **** is fun).
     
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Mar 28, 2005, 08:16 PM
 
Originally posted by nonhuman:
> I think it would be useful to take it a little farther than that doc does.
> It's because each of the three digits in the permissions number isn't actually a digit.
> It's an octet. Permissions are base-8 representations of binary strings.
Nice.

Could you take a bit further even? Some of the "numbers" used by Apple seem to go
way beyond the basic 777 limit. The first one I noticed was:
We are using special permissions for the file or directory
./System/Library/Filesystems/cd9660.fs/cd9660.util. New permissions are 33261
What up with that? Assuming 33261 is octal... when converted to binary, it becomes:
11 011 010 110 001
in which, even the last 3 octets (-w- rw- --x) makes no sense at all.
So it must be something else... but what?

Then there's the new one they just added:
We are using special permissions for the file or directory
./Library/ColorSync/Profiles. New permissions are 16893
Huh?.. why is there an '8' and a '9' ? (can't be octal... is it decimal... or hex?).

Can someone clarify please?
(Last edited by Hal Itosis; Mar 28, 2005 at 08:24 PM. )
-HI-
     
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
Mar 28, 2005, 08:45 PM
 
Originally posted by Hal Itosis:
Nice.

Could you take a bit further even? Some of the "numbers" used by Apple seem to go
way beyond the basic 777 limit. The first one I noticed was:

What up with that? Assuming 33261 is octal... when converted to binary, it becomes:
11 011 010 110 001
in which, even the last 3 octets (-w- rw- --x) makes no sense at all.
So it must be something else... but what?
33261 is decimal. In octal that would be 0100755. That's rwxr-xr-x. The fourth digit from the right (which is zero in this case) would have a value if certain special bits, like the sticky bit or setuid bit, were set. The stuff to the left of that just indicates what type of file it is. Since it's a regular file, it's 10. If it were a directory (i.e. a folder), it'd be 4 instead. A symbolic link would have a 12 there. For more info, type 'man stat' in the Terminal.

The '0' before the 10 just indicates that it's octal. Generally an octal number will begin with a 0. If it starts with 0, it's octal. If it starts with 0x, it's hexadecimal, and if it doesn't have anything in front, it's decimal.

(Of course, the 'chmod' command-line tool assumes any number you put into it will be octal, because otherwise it wouldn't make sense. This isn't necessarily true for the C interface, though)

Then there's the new one they just added:

Huh?.. why is there an '8' and a '9' ? (can't be octal... is it decimal... or hex?).

Can someone clarify please?
16893=040775. That means that it's a directory, and has permissions rwxrwxr-x.

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
Mac Elite
Join Date: Feb 2002
Location: Hilton Head, SC
Status: Offline
Reply With Quote
Mar 28, 2005, 09:24 PM
 
Here's a page I did on UNIX permissions. It includes a chart to help you convert permissions from different expressions.

http://www.tyler.mcadams.com/unix-permissions.html
     
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
Mar 28, 2005, 09:30 PM
 
Originally posted by Tyler McAdams:
Here's a page I did on UNIX permissions. It includes a chart to help you convert permissions from different expressions.

http://www.tyler.mcadams.com/unix-permissions.html
Please fix the color scheme on that page. It is difficult, at least for my color-blind eyes, to read.

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
Mac Elite
Join Date: Feb 2002
Location: Hilton Head, SC
Status: Offline
Reply With Quote
Mar 28, 2005, 10:06 PM
 
There you are.
     
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Mar 28, 2005, 11:30 PM
 
Thank you Charles.

###

Actually, let me indulge in two more (possibly rhetorical) questions:[list=1][*] Why on earth would they use decimal to communicate that info to humans? It's practically useless until converted to octal (or binary), so why not just display octal in the first place (or better yet: -rwx r-x r-x)... are they deliberately trying to be obscure?
[*] Why does Apple even bother to show us these messages about "new" perms they use... do we all need to know this? (Since when do they tell us about every little change they implement anyway?). The only thing those messages have accomplished so far is to generate a flood of needless posts from users thinking something is wrong.[/list=1]
(Last edited by Hal Itosis; Mar 29, 2005 at 11:45 AM. )
-HI-
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Mar 29, 2005, 12:15 PM
 
Originally posted by Hal Itosis:
Why on earth would they use decimal to communicate that info to humans?
Why does Apple even bother to show us these messages about "new" perms they use...
It really looks like it's just informational debugging messages that were unintentionally left in the shipping code.
     
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
Mar 29, 2005, 01:18 PM
 
Originally posted by Hal Itosis:
Thank you Charles.

###

Actually, let me indulge in two more (possibly rhetorical) questions:[list=1][*] Why on earth would they use decimal to communicate that info to humans? It's practically useless until converted to octal (or binary), so why not just display octal in the first place (or better yet: -rwx r-x r-x)... are they deliberately trying to be obscure?
Nah, they probably just used %i instead of %o in a printf statement. I wouldn't say it's deliberately trying to be obscure so much as that the programmers who designed the Repair Permissions system probably didn't anticipate end users using it as often as they do these days.

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 05:00 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2