umask per directory?

Moderator, John Quarterman std-unix at ut-sally.UUCP
Thu Feb 6 22:57:07 AEST 1986


Date: Tue, 4 Feb 86 14:05:09 est
>From: "Charles J. Antonelli" <cja%eecs.umich.csnet at CSNET-RELAY.ARPA>
Summary: Use an appropriate alias for `cd' [ Nope. -mod ]
Organization: University of Michigan EECS Dept.

I obtained the following idea from a colleague.  It can be used with csh
to achieve the desired effect.  Define the following alias:

alias cd 'if (-o .exit ) source .exit; chdir \!*; if (-o .enter ) source .enter'

Then create .enter and .exit files within the directories whose umasks
are to be controlled; the files contain the appropriate umask commands along
with anything else you wish to do whenever a directory is entered or exited.
In my case the new umask is echoed for verification.

The .exit file is useful mainly in those cases where only a small subset
of the directories have .enter files; if every directory has one then
.exit is not strictly necessary.

The alias checks for ownership to prevent possible corruption.

Charles J. Antonelli		Phone:  (313) 763-1563
The University of Michigan	Csnet:  cja at eecs.UMICH
1508 East Engineering		Usenet: cja at umich.UUCP
Ann Arbor, MI   48109			ihnp4!umich!cja

[ This is one of several such shell initialization schemes I've
received (and the only one I'm going to post).  They all miss the
point:  a new file should be created according to the modes of its
*parent* directory, not the creating process's *current* directory.
That is, "cat this > there/that" should create "that" with the same
modes regardless of where "." is.  (If "there" has the directory umask
feature enabled.)  -mod ]

Volume-Number: Volume 5, Number 38



More information about the Mod.std.unix mailing list