Re: How does chown(2) works with symlinks?

Harald Koenig (
Thu, 11 Jul 1996 19:33:19 +0200 (MET DST)

> The fact that chmod(2) could return an 'ELOOP' error (According to
> manpages 1.8) suggest that chmod() used to follow the symlink. This
> not the case anymore.

this may be a reminder from the old, broken days or just stolen fron
a broken system...

> Personally I think that it should resolve the symlink. Access and
> ownership should be controled by the file that the symlink points to.

at least for chown(1) this is a *bad* idea.
small example: you have to change the change the UID of a directory tree
from one user (e.g. moving to an other insitute; other working group etc.).


chown -R new_user.new_group ~new_user/.

may have *nasty* "side effects" when the user has a symbolic link like this one:

# ls -l ~new_user/private
total 0
lrwxrwxrwx 1 old_user old_group 11 Jul 11 19:30 ATARI! -> /etc/passwd


All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \                     ^^^^^       ^^^^^