Hard links: Why?

Christopher Provenzano proven at eng.umd.edu
Sat Aug 4 05:36:09 AEST 1990


In article <1990Jul30.153949.28122 at dg-rtp.dg.com> goudreau at larrybud.rtp.dg.com (Bob Goudreau) writes:
>
>Here's an example of the problem:
>
>1)  I create a subdirectory named "sub".
>
>2)  Unbeknownst to be me, Joe Schmo creates a hard link of his own
>    to "sub".
>
>3)  I try to rmdir "sub", which is empty, and find that I cannot,
>    because its link count is > 2.
>
>So now I'm stuck with a subdirectory that I own that lives in a
>directory that I can write, but I can't delete it!  All I know is how
>many extra links to it exist -- and I have no way of finding out
>*where* those links are.  Contrast this case to the deletion of an
>ordinary file with many links, and you'll see the difference.  There's
>nothing preventing me unlinking the file, yet there is for the
>directory.
>
>That is the behavior I find objectionable.
> 

Lets take it one step further. Suppose You have a quota and you fave a file
XXX. Joe Schmo cretes a hrd link to file XXX. Later you delete the file,
but XXX exists as another file name, so your quota is still charged for file
XXX. This can happen, also Joe Schmo could (if he's an annoying user)
link system files to random places (Granted there are ways of finding the
links.) This type of action may be deploreable, but I believe it raises the
question of letting the user make hard links at all.

Is there a particular reason that a user should be allowed to hard link a file
if he doesn't own it and doesn't have write permission to it?

--
  Christopher A. Provenzano	| System Administration is like
uucp:  uunet!mimsy!proven	| juggling, the more systems you have, 
email: proven at eng.umd.edu 	| the more likely they will be down...
voice:    (301) 454-7705	|



More information about the Comp.unix.wizards mailing list