Subject: | Need an option of creating directories with permissions more open than user's default mask |
MIME-Version: | 1.0 |
Content-Type: | text/plain; charset="UTF-8" |
X-Mailer: | MIME-tools 5.427 (Entity 5.427) |
Content-Disposition: | inline |
Content-Transfer-Encoding: | binary |
X-RT-Original-Encoding: | utf-8 |
Content-Length: | 964 |
I have frequently the need of creating files and directories having
permissions more open than the user's default.
As far as I know, Perl umask() can be used only to further restrict
user's permissions. The end result of the following code is different
when executed by different users (having different default mask):
umask(0000);
make_tree("/tmp/dir1/dir2/dir3", {mode => 0777});
This is causing several problems, since--in some cases-- the directories
created are not accessible to other users.
Since there is code relying on the existing behavior of 'mode', I would
suggest not to modify it (otherwise it would introduce security issues
in cases where one rely on this exact behavior).
I rather suggest creating the new modifier 'chmod' which will change the
directory permissions to the specified numeric value independently from
the mask, like the Perl function chmod() does.
E.g.
make_tree("/tmp/dir1/dir2/dir3", {chmod => 0777});
Thanks!
Paolo Amedeo