Re: Permissions of softlinks in /proc

Alexander Viro (viro@math.psu.edu)
Sun, 21 Nov 1999 19:25:56 -0500 (EST)


On Mon, 22 Nov 1999, Guido Flohr wrote:

> Hi,
>
> the various special softlinks in the proc filesystem (files like
> /proc/self/exe, /proc/self/root or /proc/self/fd/[0-9]*) in kernel
> version 2.0.36 have a mode of "S_IFLNK | 0700". IMHO this should be
> "S_IFLNK | 0500" because not even the superuser or the owner of the link
> has permission to remove them. Practically irrelevant but it would be
> more consistent.

First of all, permission to remove object have _NOTHING_ with permission
to modify it. On any UNIX. You are modifying directory, so you need the
write permissions on _it_. Object is garbage-collected once all links are
gone and nobody keeps it open anymore.

> And, hm, at the risk of sacrifying a holy cow, wouldn't it make sense for
> *all* symlinks to allow other modes than "lrwxrwxrwx"? I can think of
> situations where I would like to allow other people to follow a certain
> symlink but want to hide its target. And it would also be absolutely
> straightforward to "chmod -w" a symlink to avoid somebody else
> removing it.
No, it would not. chmod -w on a directory containing symlink will
do the thing. Again, files/symlinks/subdirectories are not contained in a
directory. They are referenced from there. unlink() removes a reference,
not an object. So write permissions on object are irrelevant - it's a
directory you are modifying.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/