Command reference / ifs

CHGOWN

Change Owner

Transfers ownership of IFS objects selected by path or pattern. The new owner can choose whether to revoke the former owner's authority.

Allowed environments: *ALL. Positional parameters: 2.

Parameters

OBJ Object

Sets the object, or a pattern to match multiple objects, for which ownership is to be changed.

Type
*CHAR
Required
Yes
Length
5000
Case
Mixed case
path-name
Enter the path name of the objects whose ownership is to be changed.

NEWOWN New owner

Sets the user profile of the new owner for the object. The user profile must exist when this command is run.

Type
*NAME
Required
Yes
Length
10
Case
Uppercase
name
Enter the name of the user profile.

RVKOLDAUT Revoke current authority

Controls whether the authorities for the current owner are revoked when ownership is transferred to the new owner specified for the New owner (NEWOWN) parameter.

Type
*CHAR
Required
No
Default
*YES
Length
4
Case
Uppercase

Allowed values: *NO, *YES

*YES
The authorities for the current owner are revoked when the object is transferred to the new owner.
*NO
The current owner's authority is not changed when the object is transferred to the new owner.

SUBTREE Directory subtree

Choose whether to change the objects within the subtree if the object specified by the Object (OBJ) parameter is a directory or a library.

Type
*CHAR
Required
No
Default
*NONE
Length
5
Case
Uppercase

Allowed values: *NONE, *ALL

*NONE
The objects specified by the OBJ parameter are changed. If the object is a directory or a library, it will be changed, but the directory or library contents will not be changed.
*ALL
The objects specified by the OBJ parameter are changed. If the object is a directory or a library, it will be changed as well as the contents of the directory or library and the contents of all subdirectories.

SYMLNK Symbolic link

If the object is a symbolic link, specifies whether or not to change the symbolic link or the object pointed to by the symbolic link.

Type
*CHAR
Required
No
Default
*NO
Length
4
Case
Uppercase

Allowed values: *NO, *YES

*NO
Keep the current symbolic link object. The object pointed to by the symbolic link is changed.
*YES
If the object is a symbolic link, the symbolic link is changed. The object pointed to by the symbolic link is not changed.

Examples

CHGOWN OBJ('/QSYS.LIB/USERLIB.LIB/PROGRAM1.PGM') NEWOWN(ANN)

Assigns ownership of the program named PROGRAM1, located in the user library named USERLIB, to the user named ANN. The authority is revoked from the current owner. The following examples use the chart below:

CHGOWN OBJ('/sym1') NEWOWN(SAM) SUBTREE(*ALL) SYMLNK(*NO)

Will first determine if there are subtrees to process.

CHGOWN OBJ('/sym1') NEWOWN(JOE) SUBTREE(*ALL) SYMLNK(*YES)

Will first determine if there are subtrees to process.

CHGOWN OBJ('/dir1') NEWOWN(PETE) SUBTREE(*ALL) SYMLNK(*NO)

Will first determine if there are subtrees to process. Since the object specified in the OBJ parameter is a directory, the subtrees will be processed.

CHGOWN OBJ('/dir1') NEWOWN(GEORGE) SUBTREE(*ALL) SYMLNK(*YES)

Will first determine if there are subtrees to process. Since the object specified in the OBJ parameter is a directory, the subtrees will be processed.

CHGOWN OBJ('/dir1') NEWOWN(BETTY) SUBTREE(*NONE) SYMLNK(*NO)

Will not process subtrees. Since the object specified in the OBJ parameter is not a symbolic link, the SYMLNK parameter will be ignored.

IBM command documentation

Generated from os/cl/catalog/CHGOWN.json and os/cl/help/CHGOWN.json.