Re: Proposal: restrict link(2)

=?ISO-8859-1?Q?Johan_Myr=E9en?= (jem@vistacom.fi)
Wed, 11 Dec 1996 16:51:10 +0200 (EET)


On Wed, 11 Dec 1996, James L. McGill wrote:
> On Wed, 11 Dec 1996, Harald Koenig wrote:
>
> > > If, however, /tmp/foo is a HARD link to /etc/passwd, chown("/tmp/foo",
> > > uid, gid) will lead to the user owning /etc/passwd - not a desirable
> > > thing, in general.
>
> But, this does not happen, it is not permitted, as far as I can tell.

No it's not permitted for Joe Average. And you shouldn't be chowning files
at will when running as root. Not even if the file (the link, i.e.) is in
a users home directory.

> > why is Joe Random Cracker allowed to make a hard link to /etc/passwd at all
> > (or to any other file not owed by him) ?

Why not? The user can copy the file, so why shouldn't it be possible to
make a (hard or soft) link to the file. Or the user is _not_ allowed to
copy (=read) the file, but in that case the user can't read the link
either. The user doesn't gain any additional power by linking the file,
the permissible operations on the file are exactly the same as on the
original link (except, of course, the ability to unlink the file from the
directory it was linked to).

Sorry, but I think this is a non-issue and a case of not understanding the
Unix file system semantics.

One point remains, though: By making a hard link to a file, Joe A. User
can make a file exist on a file system much longer than the owner of the
file might expect.

Johan Myreen
jem@iki.fi