umask question

Jerry Feldman gaf at blu.org
Fri Jul 12 14:05:39 EDT 2002


In addition to what has been said before, the execute bit is never set when 
you create a file other than a directory. This is why you must always set 
the execute bit for a shell script. When you create a directory the execute 
bit is set. The linker will also set the execute bits. Normally, you use 
the umask command (normally a shell builtin) to restrict permissions. This 
is why it is an inverse and xored with the default permissions.
For example, if you have a umask of 333, when you create a directory, the 
permissions will be 444, because you are turning off the execute and write 
bits.

So, a umask 000 is simply a nop. 
David Kramer wrote:
> (this is on freebsd if it matters)
> 
> If I "umask 0" and create a file, that file is coming out 666 instead of 
> 777.  Am I missing something?
-- 
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9





More information about the Discuss mailing list