Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^2: Permission problem in creating directory!by m.att (Pilgrim) |
on Apr 13, 2006 at 23:15 UTC ( [id://543251]=note: print w/replies, xml ) | Need Help?? |
This actually does the opposite of what the OP asked for. A permissive umask is a smaller number (IE: less bits turned on) than a non-permissive mask. Setting the umask to 0777 ensures that no permissions are assigned, regardless of what mode you set for mkdir (or if you leave it as the default, as above). The number in the umask is applied to the mode bits of a created file with the following logic: MODE & ~MASK So, for the mode bits 0777 and a umask of 0777: perl -e'printf "%o\n", 0777 & ~0777' =>0 (or 0000) For a umask of 0000: perl -e'printf "%o\n", 0777 & ~0000' =>777 (or 0777) By default (at least it is here), the umask is set to 022. If we use the logic above with this knowledge, we can see why the OP's mode argument to mkdir didn't take affect:
In short, the answer to the OP's question is to set the umask to 0. Note the following:
umask is slightly counter-intuitive, but I found that when I saw the boolean math it helped me to understand it much better. I hope this helps. Best Regards m.att
In Section
Seekers of Perl Wisdom
|
|