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


fchown

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

Read syntax diagramSkip visual syntax diagram
>>-fchown--fd--uid--gid----------------------------------------><

Function

fchown invokes the fchown callable service to change the owner and group of a file or directory indicated by a file descriptor. The file descriptor is specified by a number.

Parameters

fd
The file descriptor for a file or directory.
uid
The numeric UID for the new owner of the file or the present UID, or -1 if there is no change.
gid
The numeric GID for the new group for the file or the present GID, or -1 if there is no change.

Usage notes

  1. The fchown service changes the owner UID and owner GID of a file. Only a superuser can change the owner UID of a file.
  2. 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.
  3. The set-user-ID-on-execution and set-group-ID-on-execution permissions of the file mode are automatically turned off.
  4. If the change request is successful, the change time for the file is updated.
  5. 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 fd, uid, and gid were assigned a value earlier in the exec:
"fchown" fd uid gid

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014