Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.wizards Subject: Re: umask for ordinary files in CSH Message-ID: <1991Apr4.221514.16786@athena.mit.edu> Date: 4 Apr 91 22:15:14 GMT References: <1991Apr4.180206.19976@terminator.cc.umich.edu> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 40 In article <1991Apr4.180206.19976@terminator.cc.umich.edu>, bguthy@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@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710