>>-lchown--pathname--uid--gid----------------------------------><
Function
lchown invokes the lchown callable service to change the
owner or group for a file, directory, or symbolic link.
Parameters
- pathname
- The pathname for a file, directory, or symbolic link.
- uid
- The numeric UID for the new owner or the present UID, or -1
if there is no change to the UID.
- GID
- The numeric GID for the new group or the present GID, or -1
if there is no change to the GID.
Usage notes
- If lchown's target is a symbolic link, it modifies the ownership
of the actual symbolic link file instead of the ownership of the file
pointed to by the symbolic link.
- The lchown service changes the owner UID and owner GID of a file.
Only a superuser can change the owner UID of a file.
- The owner GID of a file can be changed by a superuser, or if a
caller meets all of these conditions:
- The effective UID of the caller matches the file's owner UID.
- The uid value specified in the change request matches
the file's owner UID.
- The gid value specified in the change request is the
effective GID, or one of the supplementary GIDs, of the caller.
- The set-user-ID-on-execution and set-group-ID-on-execution permissions
of the file mode are automatically turned off.
- If the change request is successful, the change time for the file
is updated.
- Values for both uid and gid must be specified
as they are to be set. If you want to change only one of these values,
the other must be set to its present value to remain unchanged.
Example
In the following example, assume that
pathname,
uid,
and
gid were assigned a value earlier in the exec:
"lchown (pathname) (uid) (gid)"