1831185 Members
2835 Online
110021 Solutions
New Discussion

umask

 
Debbie Downing_2
Regular Advisor

umask

Hi

I have tried reading the man pages on umask but cant seem to get my head around it... can anyone explain to me what this is and how it is used and what the benefits of using umask are.

Thank you

Regards

Debbie
2 REPLIES 2
Mahesh Kumar Malik
Honored Contributor

Re: umask

Hi

Please refer to following page of hp docs:

http://docs.hp.com/en/B2355-90046/ch24s35.html

Regards
Mahesh
A. Clay Stephenson
Acclaimed Contributor

Re: umask

It's actually rather simple. First, it's easier if you think of file modes (permissions) in octal rather than symbolic form. 1 = execute; 2 = write; 4 = read. Next think of owner, group, other in terms of octal digits in that order as well.

There are two components at play when a file is created. 1) Mode 2) Umask

For example, the mode of a regular file under the shell is 666; umask then "subtracts" from this mode to yield the actual mode of the file. (It's not really subtraction but you can think of it this way.) Umask cannot put in what was not there so for example, you will never be able to create a file in the shell with the execute bit set because the execute bit is not set in the default mode.

The idea behind umask is to make the system more secure. Again, with a regular file the default mode is 666. If umask were 000 then the actual mode of the file would be 666 but typically you would not want "other"s reading your file and greoup members shouldn't write to your file. A good umask for this, would be 026 or 027.
If it ain't broke, I can fix that.