Messages in this thread |  | | Date | Tue, 09 Jul 1996 10:19:20 +1000 | From | Jeremy Fitzhardinge <> | Subject | Re: How does chown(2) works with symlinks? |
| |
Linus Torvalds wrote: > If you want to change the owner of the file it points to, use: > > fd = open(...); > fchown(fd,..); > > which should always work the way you expect.
So long as you can open the file. Its possible you want to chown a file you own but can't open, and if chmod is consistent with chown (which I certainly hope is the case), you won't be able to chmod it before trying to open it.
> If you use "chown()" on the > pathname it will change the synlink itself (if you think about it, that is > actually the reasonable behaviour: otherwise you could never change the owner > of the symlink).
It might be reasonable behaviour if there were ever a need to change the owner of a symlink. However, seeing as a symlink is a mere loophole in the namespace and has no function in itself, the owner, like its mode, is completely irrelevent. The only time I can think of where you'd care about the owner is for quotas, and even then that's pretty insignificant.
It seems to me that not following symlinks will be more surprising than following them, and therefore more likely to open holes.
J
|  |