[lkml]   [1996]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: 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
    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
    of a symlink. However, seeing as a symlink is a mere loophole in the
    and has no function in itself, the owner, like its mode, is completely
    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
    them, and therefore more likely to open holes.


     \ /
      Last update: 2005-03-22 13:37    [W:0.026 / U:5.284 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site