[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: default file permissions



On Monday 10 May 2004 11:17 am, Antonio Rodriguez wrote:
> Would some explain further the 4 number system? More exactly, the last
> three numbers are clear, they are explained everywhere, but the first
> one, refering to "special", is not explained anywhere that I know. I
> will be happy to read about it. I imagine that the first digit has to
> do with the "sticky bit", about which I wouldn't mind reading. It
> seems that in most references that I have seen they don't talk about
> it much.

Okay, here goes ;) you asked for it ;)

first off, binary.... 

imagine three three digit binary numbers in a row.

000 000 000 = rwx rwx rwx

Let these represent the "bits" you are toggling 

then assign these "places" just like you would for decimal numbers.

(in decimal you have 100's place, 10's place and 1's place... in binary 
however, you use powers of 2 not 10, so you get 4's place, 2's place and 1's 
place.)

Each of these "places" can be assigned either a 0 or a 1.

421 421 421  = rwx rwx rwx

so 

rw-rw-r-- would be 110 110 100 

or...  4 + 2,  and 4 + 2, and 4 

or...  644.

Since the maximum possible number is 7 and the minimum is 0, this means
we are creating three "octal" numbers (octal meaning 8)

other examples:

rwxrwxrwx = 111 111 111 = 777
r--r--r-- = 100 100 100 = 444
rwxrwxr-x = 111 111 101 = 775

You should get the idea.

BTW, the "sticky bits" are overlaid on top of these to create the extra 
digit...
 4     2     1
rwx rwx rwx 

so group sticky would be 2777 in this example... and it prints as

rwx rws rwx


>
> Thank you all.

Attachment: pgpIbyyTCYpry.pgp
Description: signature


Reply to: