z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


lchown

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-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

  1. 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.
  2. The lchown service changes the owner UID and owner GID of a file. Only a superuser can change the owner UID of a file.
  3. 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.
  4. The set-user-ID-on-execution and set-group-ID-on-execution permissions of the file mode are automatically turned off.
  5. If the change request is successful, the change time for the file is updated.
  6. 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)"

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014