Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
fstab, umask, and chmod octal values explained (hopefully)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
happyoutkast
n00b
n00b


Joined: 17 May 2005
Posts: 47

PostPosted: Wed Jun 21, 2006 9:36 am    Post subject: fstab, umask, and chmod octal values explained (hopefully) Reply with quote

As many *nix users may know, chmod, fstab umask options, and the like can or must specifiy read/write/execute and other permissions in octal. The problem is that many of us are accustomed to using the decimal numbering system in our everyday lives and even if permissions were set using decimal, I still have yet to find something that tells me where 1 = this, 2 = that, 3 = something else. So, in an attempt to help those who are not mathematicians or computer geniuses, I think it is past due that someone has a comprehensive place to explain exactly what these numbers do when setting umask, chmod or other permissions settings.

Normally permissions are, in order: user, group, others (when running ls -l command, it will be seen as -rwxrwxrwx where the first bit is whether or not it's a directory such as drwxrwxrwx where the first three sets of rwx is the user permissions, second is for the group, and third everybody else and if it's got a - instead of a letter than those permissions don't exist or are denied).

So, to start with what I do know for octal permission settings:

0 = NO permissions (obviously)

1 = execute only permission (can cd to directory, but worthless without read permissions since you can't list files in that directory)

2 = write only access for the whatever it's set for (in umask it's set with 4 spaces, I don't know why since I'm only aware of User, group, others...)
Oddly enough this also seems to allow read and execute permissions....same as 7 I suppose as far as fstab goes at least....

Example:
umask = 0222
or
chmod 222 /some/path/somefile

3 = write and execute permission (again, useless if you can't read. How can you really write if you can't read it? well, I suppose you could...but who would want to?)

4 = Read only permission (no execute meaning can't cd to directory)

5 = Read and execute permission (no write access), good for files/partitions which you want read only access, for fstab/mount same as setting -ro option

6 = read and write permission, cannot execute (cannot exec commands on directory such as cd, among others)

7 = read/write/execute permissions, they're all turned on and you can do everything to the filesystem/file (octal numbers go from 0-7, giving 8 characters)

Example:
umask = 7777
or
chmod 777 /some/path/somefile

so, for short:

1 = execute permission (and equally able to CD into that directory)
2 = write permission
3 = write and execute permission
4 = read permission
5 = read and execute permission
6 = read and write permssion
7 = read,write and execute permission

Thanks to Naib for the contribution...

PLEASE reply here if you have any to add......


Last edited by happyoutkast on Wed Jun 21, 2006 11:35 am; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Wed Jun 21, 2006 9:51 am    Post subject: Reply with quote

happyoutkast,

Allow me to refer you to
Code:
man mount
and
Code:
man chmod
for all the gory detial.

Lets seperate out permissions and the umask settings - there is an important difference.
Most of what you say is correct for files.
The very first - on files means its a file. a d means directory, c means a character special device and b a block special device. Look in /dev for examples of c and b. There are others too.

For directories the x bit no longer means that it can be executed - that would make no sense.
It allows the affected users who have x permission to cd to that directory.

How is umask different ?
Its upside down umask=222 denies write access to everyone.
Its 555 or r-xr-xr-x permissions
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
happyoutkast
n00b
n00b


Joined: 17 May 2005
Posts: 47

PostPosted: Wed Jun 21, 2006 10:56 am    Post subject: Reply with quote

I thank you for your post, however you miss my point. I spent much of the night reviewing man pages for mount, chmod, and fstab as well as various websites (including gentoo forums) and none define exactly what the numerical values for the octal settings do in plain language, they simpy state that the certain settings must be specified in octal. What I, and I'm sure others, would LOVE to know is what those numbers MEAN. For example, if we say chmod 444 /some/path/somefile or umask=444, wtf exactly does 4 mean as far as setting permissions. Is is read,write, and execute (or as you said, allow cd to a directory), some, all, or whatever?
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Wed Jun 21, 2006 11:08 am    Post subject: Reply with quote

simple way to look at is is in binary format


Quote:

user | group| all
r w x | r w x | r w x
4 2 1 | 4 2 1 | 4 2 1


so if you want user to have read-write-execute, group to have read-write and all to have read

rwxrw-r--
which is

(4+2+1) , (4+2), (4)
764

simple
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
happyoutkast
n00b
n00b


Joined: 17 May 2005
Posts: 47

PostPosted: Wed Jun 21, 2006 11:16 am    Post subject: Reply with quote

so what is 4? what is 2? and what is 6? WTF DO THESE NUMBERS MEAN FOR PERMISSIONS!!!??? I don't mean to offend, but not everybody who uses linux is a mathematical genius. I hate to admit it, but although I've been told I can write some really good code I am horrible at math and it took me quite a while to finally "get" how to convert binary to decimal. Anybody care to offer a plain non-math degree pre-requisite explaination of what this stuff is or shall I just give up and kill this thread now? See? this is the whole reason why I started this thread, the only people that care to explain it are math geniuses and seem to expect everybody else to be the same.

sorry if I seem a bit mean, but it's irritating having the first two explainations being of no help to use mathematical idiots who happen to also be linux users (and in my case software devs too, and no you don't need to know math to make software, just the formula.....unless of course you're doing some hardcore 3D coding stuff...). Either ways, I think this is and has always been much of the problem with linux, nobody knows how to write it and make it so us normal non math geeks and others who aren't computer geeks know how the heck to use it and can without having to get a compy sci degree!!!

WHAT I'M LOOKING FOR:

1 = this permission

2 = that permission

3 = another setting

4 = this setting

and so on....


Last edited by happyoutkast on Wed Jun 21, 2006 11:19 am; edited 1 time in total
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Wed Jun 21, 2006 11:18 am    Post subject: Reply with quote

happyoutkast wrote:
so what is 4? what is 2? and what is 6? I don't mean to offend, but not everybody who uses linux is a mathematical genius. I hate to admit it, but although I've been told I can write some really good code I am horrible at math and it took me quite a while to finally "get" how to convert binary to decimal. Anybody care to offer a plain non-math degree pre-requisite explaination of what this stuff is or shall I just give up and kill this thread now? See? this is the whole reason why I started this thread, the only people that care to explain it are math geniuses and seem to expect everybody else to be the same.

sorry if I seem a bit mean, but it's irritating having the first two explainations being of no help to use mathematical idiots who happen to also be linux users (and in my case software devs too, and no you don't need to know math to make software, just the formula.....unless of course you're doing some hardcore 3D coding stuff...)


IF you only have 3 numbers (4,2 &1)
what numbers do you need to make 4
what numbers do you need to make 6
what numbers do you need to make 2

There is only 8 combinations
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
happyoutkast
n00b
n00b


Joined: 17 May 2005
Posts: 47

PostPosted: Wed Jun 21, 2006 11:22 am    Post subject: Reply with quote

slaps hand on forehead....

I give up....


and FYI, there are about 4 ways to make 8

7 + 1
6 + 2
5 + 3
and
4 + 4

now that we've covered basic arithmetic, we're still not a damn bit closer to explaining and CLEARLY defining what the hell these numbers mean for LAYMEN!!!
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Wed Jun 21, 2006 11:22 am    Post subject: Reply with quote

deleted

now it is alot easier to learn my pictograph then it is to learn that table don't you agree
_________________
Quote:
Removed by Chiitoo


Last edited by Naib on Wed Jun 21, 2006 11:32 am; edited 1 time in total
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Wed Jun 21, 2006 11:22 am    Post subject: Reply with quote

happyoutkast wrote:
slaps hand on forehead....

I give up....


and FYI, there are about 4 ways to make 8

7 + 1
6 + 2
5 + 3
and
4 + 4

now that we've covered basic arithmetic, we're still not a damn bit closer to explaining and CLEARLY defining what the hell these numbers mean for LAYMEN!!!


except 8 isn't a valid OCTAL number :roll:
OCTAL is 0 -> 7
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
happyoutkast
n00b
n00b


Joined: 17 May 2005
Posts: 47

PostPosted: Wed Jun 21, 2006 11:24 am    Post subject: Reply with quote

thank you! that is exactly what I was after. again, thanks. I can see how your pictograph makes sense now that I have the table to reference to. Either ways I think it is much nicer to have a table of reference available for those who want to learn it, or at very least not have to do math problems when all they want is to set permissions...
Back to top
View user's profile Send private message
happyoutkast
n00b
n00b


Joined: 17 May 2005
Posts: 47

PostPosted: Wed Jun 21, 2006 11:27 am    Post subject: Reply with quote

Naib wrote:
happyoutkast wrote:
slaps hand on forehead....

I give up....


and FYI, there are about 4 ways to make 8

7 + 1
6 + 2
5 + 3
and
4 + 4

now that we've covered basic arithmetic, we're still not a damn bit closer to explaining and CLEARLY defining what the hell these numbers mean for LAYMEN!!!


except 8 isn't a valid OCTAL number :roll:
OCTAL is 0 -> 7


yes, I said this earlier. Either way it's irrevelant since what I was after is already here. Now that we have both the "formula" and the table of answers, people are able to see how it works which is really what I wanted but could never find. I'm sure I'm not the only person who has been frustrated by this. I hate to say it but also adds to one of many reasons my friends don't use and will probably never use linux, too complicated for the normal "idiot" a.k.a. user.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Wed Jun 21, 2006 11:29 am    Post subject: Reply with quote

Now did you really have to get arsy with me esp when you were wrong

adding to 7 is pre-school maths, nothing special about it
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Wed Jun 21, 2006 11:31 am    Post subject: Reply with quote

But hey you got what you want so it doesn't matter
GO USA
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
happyoutkast
n00b
n00b


Joined: 17 May 2005
Posts: 47

PostPosted: Wed Jun 21, 2006 11:39 am    Post subject: Reply with quote

look, I know very well octal goes 0 to 7. I also apologized for getting mean, however you should at least be able to understand that when someone asks for a simple explaination (simple to say...a first year college student and not a mathemeticion that's supposed to know what octal codes in linux mean) that's all we really need. I don't exactly like being made to feel like a dumbass simply because I asked for a simple, easy to understand explaination. I may seem a bit defensive, but I do feel like your last comment was a little uncalled for and rude!
Back to top
View user's profile Send private message
happyoutkast
n00b
n00b


Joined: 17 May 2005
Posts: 47

PostPosted: Wed Jun 21, 2006 11:41 am    Post subject: Reply with quote

furthermore adding to 7 is very preschool math, figuring out what 0 - 7 in linux octal permission settings means isn't....
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Wed Jun 21, 2006 12:50 pm    Post subject: Reply with quote

happyoutkast,

The octal is actually shorthand for the binay beneth it

The pernissions, just one set, are
Code:
rwx
000  0
001  1
010  2
011  3
100  4
101  5
110  6
111  7
each permissions bit corresponds to each binary bit.
The octal numbers are just a convient way to group sets of permissions.
The 4,2,1 are just the weights of the binary bits.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum