Path.lchown

void lchown(int uid, int gid) const

Like chown but does not follow symlinks (operates on the link itself).

Platform semantics:

  • POSIX: Uses lchown(2) when available; otherwise attempts a best-effort

fallback via chown (documented to follow symlinks in that case).

  • Windows: Not supported; this method throws an exception.

Parameters

uidNew user ID. Pass a negative value to leave unchanged.
gidNew group ID. Pass a negative value to leave unchanged.