The owner ID and group ID of the file named by path or referenced by fd is changed as specified by the arguments owner and group. The owner of a file may change the group to a group of which he or she is a member, but the change owner capability is restricted to the super-user.
The chown system call clears the set-user-id and set-group-id bits on the file to prevent accidental or mischievous creation of set-user-id and set-group-id programs if not executed by the super-user. The chown system call follows symbolic links to operate on the target of the link rather than the link itself.
The fchown system call is particularly useful when used in conjunction with the file locking primitives (see flock(2)).
The lchown system call is similar to chown but does not follow symbolic links.
One of the owner or group ids may be left unchanged by specifying it as -1.
The chown and lchown will fail and the file will be unchanged if: