Randy's Stupid Question of the day

Duston, Hal hdusto01 at sprintspectrum.com
Fri Sep 8 16:15:23 CDT 2000


Randy,

The bits that are ON in the umask are turned OFF when a file 
is created.  So if you want to create rwxr-xr-x, you need a 
umask of 022, and then manually set the file to +x.

>From the HP/UX manpage:
When a new file is created (see creat(2)), each bit that is set 
in the file mode creation mask causes the corresponding 
permission bit in the the file mode to be cleared (disabled).  
Conversely, bits that are clear in the mask allow the 
corresponding file mode bits to be enabled in newly created 
files.  

For example, the mask u=rwx,g=rx,o=rx (022) disables group and 
other write permissions.  As a result, files normally created 
with a file mode shown by the ls -l command as -rwxrwxrwx (777) 
become mode -rwxr-xr-x (755); while files created with file mode 
-rw-rw-rw- (666) become mode -rw-r--r-- (644).  

Note that the file creation mode mask does not affect the 
set-user-id, set-group-id, or "sticky" bits.

I am not sure how to get the execute bits to be on by default...

Hal Duston
hald at sound.net

Randy Rathbun [randy at rrr.2y.net] wrote:
> Okay, I give.
> 
> How in the world does umask work? I am trying to change it to
> rwxr-xr-x. If it is 022, it is rw-r--r--. Okay, *that* makes total
> sense... ahem. 
> 
> And then setting it to 220 results in r--r--rw. And even 
> stranger stuff
> starts if I go to other numbers. 
> 
> Anyone care to explain this?
> 
> 
> Randy Rathbun
> randy at rrr.2y.net
> http://rrr.2y.net




More information about the Kclug mailing list