Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use File:Path to simplify the creation of directories and I am having issues with setting the permissions.

using the line: mkpath('./test/imadethis',0,0777);

does NOT give all uses write access to the newly created directory. In fact, not matter what combinations of permissions I use can give write access to all users, but owner and group work as expected.

All users have write permission to ./test

any ideas?

Replies are listed 'Best First'.
Re: File::Path problem
by ferrency (Deacon) on Apr 24, 2002 at 17:39 UTC
    perldoc -f umask

    Your current umask is probably preventing the bits from being set properly. If you do a chmod after the fact, they'll be set correctly. You could also reset your umask, but that has the potential to cause you to create files/directories in other places with insecurely lax permissions.

    Alan

Re: File::Path problem
by stephen (Priest) on Apr 24, 2002 at 17:39 UTC

    The permissions on newly created directories are modified by your umask value. So if you create a new directory (with mkpath or mkdir) with specified permissions of 0777 but with a umask of 022, then the mode of the directory will be 0755.

    See umask for how to change your umask value.

    stephen