Re: sys_chown() hits symlinks

Albert D. Cahalan (
Fri, 23 Jan 1998 18:42:59 -0500 (EST)

Scott M. Long writes:
> Stefan Monnier wrote:
>> (H. Peter Anvin) writes:

>>> Incorrect. Neither the owner nor the mode of a symlink have any
>>> effects, whatsoever.
>> And that's too bad ! Any idea why unix does it this way and why
>> no unix derivative got rid of this appearently stupid behavior ?
> Imagine two scenarios.
> ----- 1 -----> Symlink gives more priviledges than the file it points to
> ----- 2 -----> Symlink gives fewer priveledges than the file it points to

Of course that does not make sense, since you assume that the permissions
would somehow apply to the file which is pointed to.

The permissions must apply to the symlink itself. Read permission
is permission to read the contents of the symlink itself, not the file
pointed to. Execute permission is permission to follow the symlink.
This means you can have symlinks that can be followed to secret
locations without giving away the secret. Add the suid or sgid bit
to let people traverse directories as the symlink owner. That would
allow access to specific files in a mode 700 directory.