in reply to RE: Chmod
in thread Chmod

Actually, the umask merely sets the default permissions. If you use chmod, you can set the permissions to anything you want (assuming you own the file).

Replies are listed 'Best First'.
RE: RE: RE: Chmod
by BBQ (Curate) on May 04, 2000 at 02:56 UTC
    You're absolutely right! My bad...

    At first, when I read your post, I though, "This can't be right! I've been doing this for ages now!" And then I tested it:
    johnny@chthon:~/tmp > mkdir foobar johnny@chthon:~/tmp > ls -l total 1 drwxr-xr-x 2 johnny users 1024 May 4 07:10 foobar johnny@chthon:~/tmp > perl -e 'umask(0666); chmod(0777,'foobar');' johnny@chthon:~/tmp > l total 4 drwxr-xr-x 3 johnny users 1024 May 4 07:10 ./ drwx------ 12 johnny users 2048 May 3 23:09 ../ drwxrwxrwx 2 johnny users 1024 May 4 07:10 foobar/ johnny@chthon:~/tmp >
    'nough said! I've been doing it wrong for ages... Thanks!
      Other things, such as mkdir, are affected by the umask:
      andy@okura:[/tmp/test] mkdir foobar andy@okura:[/tmp/test] ls -l total 4 drwxr-xr-x 2 andy andy 4096 Jun 20 14:55 foobar andy@okura:[/tmp/test] perl -e 'umask(0666); chmod(0777,'foobar'); \ > mkdir('foobar2',0777);' andy@okura:[/tmp/test] ls -l total 8 drwxrwxrwx 2 andy andy 4096 Jun 20 14:55 foobar d--x--x--x 2 andy andy 4096 Jun 20 14:55 foobar2