umask for ordinary files in CSH
Jonathan I. Kamens
jik at athena.mit.edu
Fri Apr 5 08:15:14 AEST 1991
In article <1991Apr4.180206.19976 at terminator.cc.umich.edu>, bguthy at engin.umich.edu (bala s guthy ) writes:
|> I am reposting this here since I did not receive any replies for
|> this one on c.u.q
Well, I didn't see your original question, and I read c.u.q quite
thoroughly. Perhaps you should have used a wider distribution? I got this
message, even though it had a distribution of "sa", but perhaps that's just a
fluke.
|> --- Here is what the man page for csh says.
|>
|> 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.
The man page is wrong in two different ways. First of all, it is not true
that 666 and 777 are the permissions that are always checked against. The
permissions that are checked against are the permissions that the program that
creates the file or directory asked for. For example, a compiler outputting
an executable might ask for 777 on a file, and a program that creates
directories that it knows should not be world-readable might ask for 700 or
770.
Second, the permissions are not XORed. The requested permissions are ANDed
with the negation of the umask, so that the bits that get set in the final
permissions are the bits that are set in the requested permissions and are not
set in the umask.
--
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik at Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8085 Home: 617-782-0710
More information about the Comp.unix.wizards
mailing list