umask per dir

Moderator, John Quarterman std-unix at ut-sally.UUCP
Tue Feb 4 04:07:35 AEST 1986


>From: jsq at sally.utexas.edu (John Quarterman)
Date: Mon, 3 Feb 1986 12:00:13 CST

> As a big fan of least common denominator, rather than feeping creaturism,
> I would note that it is quite easy to get umask/dir, by simply using
> the facilities provided by your shell.  For instance, using csh,
> alias cd to do 'source .exitdir; cd \!* ; source .enterdir' , and
> use the shell scripts called .enterdir and .exitdir to do directory
> specific initializations.
> 
> 			***dan

To set up a source tree so that everybody used the same umask on it
with your method would require everybody to change their .cshrc.
To do it with real umask per directory would require only setting
the umask for the directory.  The latter looks more like the least
common denominator to me.

The more interesting question is *how* do you set a umask on a
directory?  Do you try to derive the bits from the directory mode
bits in some way, such as setgid means apply the group mode bits
as the mask?  Or do you have to have an extra word in the inode?
Or do you do it by a file in the directory?  And how do you get
the umask inherited by child directories?

I would think the preferred approach would be to somehow derive
the umask from the directory mode bits.  Inheriting could be done
by just setting the umask for all the subdirectories with find.
Except that mkdir should likely make sure the umask were inherited.

One wonders if most of the people for umask per directory are using
4.2BSD or 4.3BSD and those against are using other systems.
The desirability becomes obvious after you get used to the 4.2BSD
method of assigning the group of a new file according to the group
of its parent directory.

Volume-Number: Volume 5, Number 30



More information about the Mod.std.unix mailing list