Strange umask behavior

Brad De Vries devriesbj at gmail.com
Tue Jun 12 18:45:25 UTC 2007


On 6/12/07, Adrienne J Davis <dreadgeek at gmail.com> wrote:
> A colleague of mine at work asked me to do the following:
>
> umask 000
> touch foo.sh
> ls -l foo.sh
>
> What we expected was that the permissions would be set 777, but they were
> set 666.  Does anyone have any ideas as to why this might be?
>
> Cheers
> Aj

You have to remember that umask does a bitwise AND with 666 when
creating files and 777 when creating directories.  That's the default
file creation behavior for Linux and UNIX.

So, if you had created a directory, you would have seen 777 but a file
will only get 666 at best.  If you want 777 for a file, you have to
chmod it.

Brad.




More information about the kubuntu-users mailing list