Hard links to directories: why not?

Steven Bellovin smb at ulysses.att.com
Thu Jul 19 05:14:35 AEST 1990


In article <5222 at milton.u.washington.edu>, wiml at milton.u.washington.edu (William Lewis) writes:
> 
>    In the man entry for ln(1) (and for link(2)),  it says that
> hard links may not be made to directories, unless the linker is
> the super-user (in order to make '.' and '..', I suppose). My 
> question is: why not? (and is there any reason that I, if I'm
> root, shouldn't do this?) It seems perfectly harmless to me, although 
> it would allow the user to make a pretty convoluted directory structure,
> that's the user's priviledge. So I suppose it's probably a security
> issue somehow (restrictions of this sort seem to be). Hence the
> crosspost to alt.security. 

I quote from the original Ritchie and Thompson paper:

	The directory structure is constrained to have the form of a
	rooted tree.  Except for the special entries ``.'' and ``..P'',
	each directory must appear as an entry in exactly one other
	directory, which is its parent.  The reason for this is to
	simplify the writing of programs that visit subtrees of the
	directory structure, and more important, to avoid the
	separation of portions of the hierarchy.  If arbitrary links to
	directories were permitted, it would be quite difficult to
	detect when the last connection from the root to a directory
	was severed.

No need for excess paranoia...



More information about the Comp.unix.wizards mailing list