[wplug] umask

Mark Dalrymple wplug at badgertronics.com
Tue Apr 29 14:10:32 EDT 2003


> I don't remember what operation is used between the 
> permissions and the umask to get the actually permissions used. umask is 
> part of bash, so you could look at man bash for more.

The umask is used when creating files.  The system takes the 
permissions the application asks for, and then removes the bits
specified in the umask.

So, if the app asks for

 u   g  o     (user group other)
rwx rwx rwx   (read write execute)
111 111 111   777 (octal)

and the umask is
000 010 010   022 (octal)

The resulting result is
111 101 101
or,
rwx r-x r-x

(for the geeks, the umask is complemented, the bitwise ANDed with the
permissions the program asks for)

Put another way, 022 umask will strip off the write permissions for
group and for others for newly created files.  umask has not affect on
existing files.  (if aprogram saves a file by creating a new one and
writing to it, then the umask will apply to that)

++Mark Dalrymple, markd at badgertronics.com.  http://badgertronics.com
   "apathy! apathy is our cry A-P-aaa forget it."
    -- jo2y



More information about the wplug mailing list