Hard links to directories: why not?

Paul Shields shields at yunexus.YorkU.CA
Thu Jul 19 14:26:33 AEST 1990


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?)

Imagine the fun a user could have with the following:

% ln . foo
% ln .. bar

It would annoy a lot of the utilities you might like to run, like
du, ls -R, etc.

>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. 

Well, perhaps the following could be hazardous:

# rm -r bar

Just a thought.

-- 
Paul Shields             shields at nccn.yorku.ca

P.S: on VAX/VMS 3.7 the above (with a different command set of course)
is possible. I don't know about old versions of UNIX.



More information about the Comp.unix.wizards mailing list