File Write Permission Rules
William C. DenBesten
denbeste at bgsuvax.UUCP
Fri Feb 10 01:53:26 AEST 1989
>From article <306 at wubios.wustl.edu>, by david at wubios.wustl.edu (David J. Camp):
> We have a strange situation where a program can write to a file even
> though it does not have write permission. What it does is remove the
> file and write a new one in its place. It can do this because it has
> write permission to the directory in which the file is contained.
>
> My question is: What is the (historical or otherwise) justification for
> this rule? It seems wrong. I would have required write permission to
> the file itself in order that it be removed.
When you remove a file, what you really are doing is edit the
directory so that the file is no longer in it. Hence, you need write
permission on the directory. You are not making any changes to the
contents of the file, so you don't need to be able to write to the
file. After you remove the file, the kernel notices that there is a
file that is not in any directory and frees up the space.
This has been simplified just a tad.
--
William C. DenBesten
denbeste at bgsu.edu
More information about the Comp.unix.questions
mailing list