SUMMARY: umask question

From: SIMEONE, Allan J. <Allan.SIMEONE_at_rp-rorer.com>
Date: Wed, 29 Jul 1998 13:55:16 -0400

Following is the summary to my question about umask. Doesn't seem
possible
to create a file with rwxrwxr-x as the default unless using some kind of
wrapper with
a chmod in it.

thanks for replies from:

alan_at_nabeth.cxo.dec.com
rrodrigu_at_ssc.wisc.edu
oisin_at_sbcm.com

and replies are still coming in but I get the point :-)

original question follows summary.

in summary...

Unfortunately, you will not be able to use a umask to control this.
In csh, tcsh, bash, and sh, the umask is a shell built-in command.
This comes from the csh man page (the most technically clear
statement):

     umask [ value ]
               Display the file creation mask. With value set
               the file creation mask. value is given in octal,
               and is XORed with the permissions of 666 for files
               and 777 for directories to arrive at the permis-
               sions for new files. Common values include 002,
               giving complete access to the group, and read (and
               directory search) access to others, or 022, giving
               read (and directory search) but not write permis-
               sion to the group and others.
               .
               .
               .
        Depending on how the file is created, some type of wrapper might
        do the trick.

and...

           The creat(2) and open(2) system calls have a mask argument
        that is used with the umask to create the initial mask of
        a file. If the particular application didn't see fit to
        allow files to be created with the execute permission turned
        on, there's no way umask can change it. Example:

                fd = open("file", O_CREAT, 0644) ;

        The mask of 0644 limits the permission to 0644 at most. The
        umask only turns off bits. However, if the caller of open
        had used 0777, then any reasonable permission is possible.


original question follows...
>----------
>From: SIMEONE, Allan J.
>Sent: Wednesday, July 29, 1998 1:09PM
>To: 'alpha-osf-managers_at_ornl.gov'
>Subject: umask question
>
>Hi,
>
>We need to create a file with the default permissions rwxrwxr-x. Can
>this be done
>by setting the umask? I would think setting the umask to 002 would do
>this, but
>it creates the file as rw-rw-r--. Do I have to change anything else for
>this to take effect?
>
>thanks,
>Allan
>
Received on Wed Jul 29 1998 - 17:57:02 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:38 NZDT