From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078715812018.tru64-unix-managers.marc@archive.invalid> From: "SIMEONE, Allan J." Date: Wed, 29 Jul 1998 17:55:16 +0000 To: tru64-unix-managers Subject: SUMMARY: umask question X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078715812018 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@nabeth.cxo.dec.com rrodrigu@ssc.wisc.edu oisin@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@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 >