[wplug] umask
Sal Mangiapane
salm at servanttechnology.com
Tue Apr 29 17:19:53 EDT 2003
> -----Original Message-----
> From: wplug-admin at wplug.org [mailto:wplug-admin at wplug.org]On Behalf Of
> Mark Dalrymple
> Sent: Tuesday, April 29, 2003 2:11 PM
> To: wplug at wplug.org
> Subject: Re: [wplug] umask
>
>
> > 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)
If this is bitwise ANDed it would be:
000 010 010
or,
--- -w- -w-
And when you do chmod that is exactly what happens. So, chmod must be bitwise ANDed.
For me, I like to think of it as the binary value:
124 124 124 this seems easier for me. a 7 is 1+2+4 (111). a 5 is 1+0+4 (101). a 644 is 011 001 001 or -wx --x --x
I'm not sure, but UMASK must be bitwise ORed which gives the 111 101 101 result that Mark described.
>
> 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
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>
>
Thanks and God bless,
sal
More information about the wplug
mailing list