UNIX-WIZARDS Digest V12#067

Ana Maria De Alvare' anamaria at saffron.wpd.sgi.com
Sat Apr 6 08:42:58 AEST 1991


Re: to umask issue

Here is the original mail:
---
--- Here is the test.

% umask 166
% umask
166
% touch jj
% ls -l jj
   0 -rw-------  1 bguthy          0 Mar 30 13:55 jj
%

--- Here is the question.

166 EXOR 666 = 700  which should be -rwx------
Am I doing something wrong here, or is this a bug, any explanation would
be helpful.

-----
-----------------------------------------------------
This is my interpretation of the umask behavior

Umask works as follows:

The umask number is used with a 777 permission setting.
If you choose umask 166 then you are stating that your execution privilege
for owner should be cleared, your read/write for group and other are cleared.

When you do a touch, you are creating a file that is not an executable, 
therefore you will get 
   0 -rw-------  1 bguthy          0 Mar 30 13:55 jj

   If at time of creation, you were creating an executable; jj would have:

   0 -rw---x--x  1 bguthy          16 Mar 30 13:55 jj


In other words, what umask does is to tell the system which permission bits
to turn off.  For example the number 2 will turn off write permission the same
as number 3 does.  However number 3 can turn off execute as well.


-------------------------------------------------------------------------------
Ana Maria De Alvare' 	MTS Secure IRIX            	 Silicon Graphics, Inc.
anamaria at sgi.COM    {decwrl,sun}!sgi!whizzer!saffron!anamaria      415-335-7309

-------------------------------------------------------------------------------







More information about the Comp.unix.wizards mailing list