umask question
John Chambers
jc at trillian.mit.edu
Fri Jul 12 12:25:01 EDT 2002
David Kramer writes:
| On Fri, 12 Jul 2002, Nathan Meyers wrote:
| > The mode of a newly created file is set (and modified by the umask)
| > in the low-level creat(2) or open(2) system call. Most applications -
| > including anything using the C library's fopen(3) call - don't set the
| > execute bits at the time the file is created. So your umask setting
| > allows the execute bits to be set at file creation if the app requests
| > it... but the app still has to request it.
|
| Thanks. That just seems so wrong to me though. If I set a umask, why
| wouldn't creat() and open() honor it? Isn't that what umask is for?
No; umask is for overriding the permissions requested by
programs. It's a way of saying "I don't care what
permissions a program requests; the following permission
bits should be turned OFF."
There is an asymmetry here. Logically, you could also have
a second mask that means "I don't care what permissions a
program requests; the following permission bits should be
turned ON." But this has never existed, probably because
there hasn't been a groundswell of demand for it. People
are usually more concerned with blocking access than with
guaranteeing access.
More information about the Discuss
mailing list