[RndTbl] How does umask really work?

Gilles Detillieux grdetil at scrc.umanitoba.ca
Thu Feb 10 09:16:36 CST 2005


On Wednesday, Feb 9, 2005, at 22:18 CST, John Lange wrote:
> So the bottom line is, you can not set a default create mode for files
> to be 755 since the mode is implemented in each individual program.
>
> The best you can do is set modes that can NOT be created by default.
>
> IMHO there should be a kernel setting for this (
> /proc/sys/fs/filecreatemode /proc/sys/fs/dircreatemode seems logical).
>
> But of course a LOT of programs would have to be changed to take
> advantage of that.

This raises the question of what, exactly, would be the advantage of 
that.  Programs tend to turn on the right bits by default for the type 
of file being created, and I'd be hard pressed to come up with an 
example of where it would be useful to override that default.  
Directories have execute permissions turned on by default because it 
makes sense (execute = traversal for directories).  Regular files don't 
usually have execute permission turned on by default because it doesn't 
usually make sense, unless they actually contain executable code which 
you want to run as a command.  ld turns on execute permission on 
binaries after successfully linking them, as they're then ready to 
execute.  When you create executable text files, i.e. scripts (shell, 
awk, perl, etc.), then you can easily add execute permission with chmod 
+x, but you'd only do that if you really want them to be run as 
commands.  Why would you want execute permission on by default for all 
regular files?

-- 
Gilles R. Detillieux              E-mail: <grdetil at scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/
Dept. Physiology, U. of Manitoba  Winnipeg, MB  R3E 3J7  (Canada)



More information about the Roundtable mailing list