 |
 |
Explain user permission numbers
|
 |
|
 |
|
Mac Enthusiast
Join Date: Feb 2005
Status:
Offline
|
|
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
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
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
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Jun 2001
Location: Washington DC
Status:
Offline
|
|
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
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2002
Location: Hilton Head, SC
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Dec 2000
Status:
Offline
|
|
Please fix the color scheme on that page. It is difficult, at least for my color-blind eyes, to read.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2002
Location: Hilton Head, SC
Status:
Offline
|
|
There you are. 
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Mar 2004
Status:
Offline
|
|
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
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|