Changes the user and group ownership of the specified file.
Format
#include <unistd.h>
int lchown (const char *file_path, uid_t file_owner, gid_t
file_group);
1 – Arguments
file_path
The name of the file for which you want to change the owner and
group IDs.
file_owner
The new user ID for the file.
file_group
The new group ID for the file.
2 – Description
The lchown function changes the owner and/or group of the
specified file (file_path). If the file is a symbolic link, the
owner of the symbolic link is modified (in contrast to chown
which would modify the file that the symbolic link points to).
See also symlink, unlink, readlink, realpath, and lstat.
3 – Return Values
0 Successful completion.
-1 Indicates an error. errno is set to any errno
value returned by chown.