[wplug] umask

Sal Mangiapane salm at servanttechnology.com
Wed Apr 30 09:34:01 EDT 2003


> Please read it again.  the umask is *complemented* (bits are
> flipped), and then ANDed.  The math works.
>
>
>
> >>  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 complement of the umask  is
>   111 101 101
>
> Then AND that with the original, (all 1-s)
> you get my original result:
>
> >> The resulting result is
> >> 111 101 101
> >> or,
> >> rwx r-x r-x
>
>

Yes I see it.  I was going by your equation that did not show the complement.  By including the complement step I can see how the
bitwise AND works.  I never liked umask because I didn't understand how it worked, now I am comfortable with what it is actually
doing.

Sorry about bringing in chmod.  I think more people are familiar with chmod and it requires a option of 000 - 777 as input and it
also effects permissions.  I was not trying to explain umask but I was trying to explain the required options for umask which are
similar to the options for chmod.

thanks and God bless,

sal





More information about the wplug mailing list