[H-GEN] Re: [Linux-SA] file permisions (fwd)

Andrae Muys A.Muys at mailbox.uq.edu.au
Wed Feb 11 20:00:14 EST 1998


Sorry I had meant this reply to go to the list.

Andrae

---------- Forwarded message ----------
Date: Thu, 12 Feb 1998 10:43:45 +1000 (GMT+1000)
From: Andrae Muys <cmamuys at mailbox.uq.edu.au>
Reply-To: andrae at humbug.org.au
To: Trevor Van Der Linden <trevor at bold.net.au>
Subject: Re: [Linux-SA] file permisions

On Thu, 12 Feb 1998, Trevor Van Der Linden wrote:

> Hi,
> Anyone have a list of the chmod xxx filename numbers and what they do?
> the xxx part that is.     I know I can go ug+rw and then o+r.
> Thanks

Well there isn't actually a list because the number is a direct
representation of the permissions you want.

OK, Consider the following permission slots

drwsrwsrwt	andrae	andrae	0 Feb 12 10:29 testfile

OK, Now break them up into triplets like so.

d sst rwx rwx rwx
0 123 456 789 ABC

Now convert each of the 4 triplets into a octal number

sst rwx rwx rwx
 7   7   7   7

So the mode for all permission bits set is 7777.

--- rwx rwx rwx
 0   7   7   7      For a normal world executable file 777 (or 0777 :).

s-- rwx --x --x     For a normal setuid binary 4711

--t rwx rwx rwx     For /tmp 1777

--- rw- rw- r--     For a normal file 664 (or 0664).

Now you may not be used to octal notation.  Octal notation is just base 8.
So if you consider each triplet to be a binary number.

b2    =           = b8
0 0 0 = 0 + 0 + 0 = 0
0 0 1 = 1 + 0 + 0 = 1
0 1 0 = 0 + 2 + 0 = 2
0 1 1 = 1 + 2 + 0 = 3
1 0 0 = 0 + 0 + 4 = 4
1 0 1 = 1 + 0 + 4 = 5
1 1 0 = 0 + 2 + 4 = 6
1 1 1 = 1 + 2 + 4 = 7

I prefer working in octal for chmod, because I find it easier decide on
the exact permissions I want the file to have and assign the file them
directly, rather then trying to pass the difference between what is there
and what I want.  (And of course being an engineer I have absolutely no
trouble at all thinking in binary/octal/hexidecimal).

Anyway hope this helps

Andrae Muys

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Andrae Muys              "I have no wish to recite ... stratagems, for they
andrae at humbug.org.au     have all the same end in view, which is, to oblige
My stuff, Linux stuff        the enemy to make unnecessary marches in favor 
http://www.uq.edu.au/~cmamuys/   of our own designs." - Fredrick the Great.


----------------------- HUMBUG General List --------------------------------
echo "unsubscribe general" | mail majordomo at humbug.org.au # To Unsubscribe



More information about the General mailing list