Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!bgsuvax!denbeste From: denbeste@bgsuvax.UUCP (William C. DenBesten) Newsgroups: comp.unix.questions Subject: Re: File Write Permission Rules Message-ID: <3558@bgsuvax.UUCP> Date: 9 Feb 89 15:53:26 GMT References: <306@wubios.wustl.edu> Organization: Bowling Green State University B.G., Oh. Lines: 22 From article <306@wubios.wustl.edu>, by david@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@bgsu.edu