Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

fstab, umask, and chmod octal values explained (hopefully)

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
16 posts • Page 1 of 1
Author
Message
happyoutkast
n00b
n00b
Posts: 47
Joined: Tue May 17, 2005 10:42 am

fstab, umask, and chmod octal values explained (hopefully)

  • Quote

Post by happyoutkast » Wed Jun 21, 2006 9:36 am

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.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56085
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Jun 21, 2006 9:51 am

happyoutkast,

Allow me to refer you to

Code: Select all

man mount
and

Code: Select all

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.
Top
happyoutkast
n00b
n00b
Posts: 47
Joined: Tue May 17, 2005 10:42 am

  • Quote

Post by happyoutkast » Wed Jun 21, 2006 10:56 am

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?
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Wed Jun 21, 2006 11:08 am

simple way to look at is is in binary format

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
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
happyoutkast
n00b
n00b
Posts: 47
Joined: Tue May 17, 2005 10:42 am

  • Quote

Post by happyoutkast » Wed Jun 21, 2006 11:16 am

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.
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Wed Jun 21, 2006 11:18 am

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
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
happyoutkast
n00b
n00b
Posts: 47
Joined: Tue May 17, 2005 10:42 am

  • Quote

Post by happyoutkast » Wed Jun 21, 2006 11:22 am

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!!!
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Wed Jun 21, 2006 11:22 am

deleted

now it is alot easier to learn my pictograph then it is to learn that table don't you agree
Last edited by Naib on Wed Jun 21, 2006 11:32 am, edited 1 time in total.
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Wed Jun 21, 2006 11:22 am

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
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
happyoutkast
n00b
n00b
Posts: 47
Joined: Tue May 17, 2005 10:42 am

  • Quote

Post by happyoutkast » Wed Jun 21, 2006 11:24 am

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...
Top
happyoutkast
n00b
n00b
Posts: 47
Joined: Tue May 17, 2005 10:42 am

  • Quote

Post by happyoutkast » Wed Jun 21, 2006 11:27 am

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.
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Wed Jun 21, 2006 11:29 am

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
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Wed Jun 21, 2006 11:31 am

But hey you got what you want so it doesn't matter
GO USA
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
happyoutkast
n00b
n00b
Posts: 47
Joined: Tue May 17, 2005 10:42 am

  • Quote

Post by happyoutkast » Wed Jun 21, 2006 11:39 am

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!
Top
happyoutkast
n00b
n00b
Posts: 47
Joined: Tue May 17, 2005 10:42 am

  • Quote

Post by happyoutkast » Wed Jun 21, 2006 11:41 am

furthermore adding to 7 is very preschool math, figuring out what 0 - 7 in linux octal permission settings means isn't....
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56085
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Jun 21, 2006 12:50 pm

happyoutkast,

The octal is actually shorthand for the binay beneth it

The pernissions, just one set, are

Code: Select all

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.
Top
Post Reply

16 posts • Page 1 of 1

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic