CHGOWN (Change Owner)

CHGOWN Command syntax diagram

 

Purpose

The Change Owner (CHGOWN) command transfers object ownership from one user to another. The authority that other users have to the object does not change.

The owner of an object always has all the authorities applicable to the object unless they are explicitly revoked. The new owner is given all of the authorities to the object when the ownership is changed. The owner of an object has the authority to grant any authorities to any user for that object. Owners can also grant to themselves authorities that were previously revoked. Owners may, for example, remove some of their specific authorities as a precautionary measure, and then, when the need arises, grant those same authorities to themselves again.

A user with *ALLOBJ has complete authority for all objects and can transfer the ownership of any object. All users have add and delete authorities for their own user profiles; that is, users can add objects to, or delete objects (that they created) from their own user profiles by transferring the ownership of the object.

For more information about integrated file system commands, see Integrated file system topic in the File systems and management category of the Information Center.

 

Restrictions

  1. To transfer ownership of an object in the QSYS.LIB or independent ASP QSYS.LIB > file system, have all of the following:

    • Object existence authority for the object
    • Object operational and object existence authorities if the object is a file, library, or subsystem description
    • *ALLOBJ special authority or ownership if the object is an authorization list
    • Add authority for the new owner's user profile
    • Delete authority for the present owner's user profile

  2. Changing the ownership of an object that has an authority holder associated with it also changes the ownership of the authority holder.
  3. You must have *ALLOBJ and *SECADM special authorities to change the object owner of a program that adopts authority.

 

Required Parameters

OBJ
Specifies the path name of the object that is being assigned to the new owner. See path names for more information on specifying path names.

NEWOWN
Specifies the name of the user to whom the object is being assigned. The user profile must already exist.

 

Optional Parameters

RVKOLDAUT
Specifies whether the authorities for the current owner are revoked when ownership is transferred to the new owner specified in the NEWOWN parameter.

*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.

SYMLNK
Specifies whether to change the ownership of the object or the symbolic link to the object.

*NO: The ownership of the object, not the symbolic link to the object, is changed.

*YES: If the object for which ownership is changing is a symbolic link, the ownership of the symbolic link is changed instead of changing the ownership of the object that the symbolic link points to.

Example for CHGOWN

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

This command 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.

Error messages for CHGOWN

*ESCAPE Messages

CPDA080
User profile name too long.
CPE3101
A non-recoverable I/O error occurred.
CPE3408
The address used for an argument was not correct.
CPE3418
Possible APAR condition or hardware failure.
CPE3474
Unknown system state.
CPFA0AA
Error occurred while attempting to obtain space.
CPFA0AB
Object name not a directory.
CPFA0AD
Function not supported by file system.
CPFA0A1
An input or output error occurred.
CPFA0A2
Information passed to this operation was not valid.
CPFA0A3
Path name resolution causes looping.
CPFA0A4
Too many open files for process.
CPFA0A5
Too many open files.
CPFA0A7
Path name too long.
CPFA0A9
Object not found.
CPFA0B1
Requested operation not allowed. Access problem.
CPFA0C0
Buffer overflow occurred.
CPFA0C1
CCSID &1 not valid.
CPFA0CE
Error occurred with path name parameter specified.
CPFA0DD
Function was interrupted.
CPFA0D4
File system error occurred.
CPFA08B
Path name cannot begin with *.
CPFA08C
Pattern not allowed in path name directory.
CPFA085
Home directory not found for user &1.
CPFA086
Matching quote not found in path name.
CPFA087
Path name contains null character.
CPFA088
Path name pattern not valid.
CPFA09C
Not authorized to object.
CPFA09D
Error occurred in program &1.
CPFA09E
Object in use.
CPFA09F
Object damaged.
CPFA091
Pattern not allowed in user name.
CPFA092
Path name not converted.
CPFA093
Name matching pattern not found.
CPFA094
Path name not specified.
CPF1F05
Directory handle not valid.
CPF1F41
Severe error occurred while addressing parameter list.
CPF1F4A
Value for number of directory entries not valid.
CPF1F53
Value for length of data buffer not valid.
CPF220A
New owner &1 does not have a uid.
CPF2203
User profile &1 not correct.
CPF2204
User profile &1 not found.
CPF2213
Not able to allocate user profile &1.
CPF2217
Not authorized to user profile &1.
CPF2225
Not able to allocate internal system object.
CPF9801
Object &2 in library &3 not found.
CPF9802
Not authorized to object &2 in &3.
CPF9803
Cannot allocate object &2 in library &3.
CPF223A
Not all objects changed.
CPF3BF6
Path Type value is not valid.