CPF2189: Not authorized to object
CPF2189 means the user profile running the command doesn't have the authority the command needs to the object named. The message gives the object, library and object type.
Other names for this code
Also written as CPF2189 not authorized to object, MSGID CPF2189, MONMSG CPF2189, RNMOBJ CPF2189, not authorized to object type.
What it means
CPF2189 is an escape message from QCPFMSG with the text "Not authorized to object &1 in &2 type *&3". It is the library and object command version of CPF9802. The object was found, but the authority check on it failed.
Commands that manage objects need more than the right to use them. RNMOBJ needs object management authority (*OBJMGT) to the object, and update and execute authority to its library. CRTDUPOBJ needs *USE and *OBJMGT to the object it copies. Deleting an object needs object existence authority. A user with *CHANGE authority to a file can work with all its data and still be refused a rename, because *CHANGE doesn't include object management.
IBM i takes the user's authority from *ALLOBJ special authority, private authority, group profiles, an authorization list, *PUBLIC, and authority adopted from programs on the call stack. Any of these can be the reason the user had access before and doesn't now.
Common causes
- The user has data rights (*USE or *CHANGE) but not object management or existence authority, which renames, moves, copies and deletes need.
- The object's *PUBLIC authority is *EXCLUDE, and the user has no private or group authority.
- The object was created or restored with different authority, for example under the library's CRTAUT value.
- A program that used to adopt its owner's authority was recompiled or re-owned and no longer adopts it.
- The command runs in a batch job under a different user profile than the person who submitted it expected.
How to find the problem
- Open the job log with DSPJOBLOG, put the cursor on CPF2189 and press F1. The help shows the object, library and type. The command logged just before it shows what was being attempted.
- Run
DSPOBJAUT OBJ(ACCTLIB/to see the authority each user and group holds. Check whether the user's authority includes *OBJMGT or *OBJEXIST, not only *USE or *CHANGE.PAYMAST) OBJTYPE(*FILE) - Run DSPUSRPRF to see the user's group and supplemental group profiles, and compare them with the object's authority list.
- If auditing includes *AUTFAIL, the security officer can find an AF entry in QAUDJRN that shows the exact object and user.
How to fix it
- Grant only what the command needs. For a rename that is object management, for example
GRTOBJAUT OBJ(ACCTLIB/.PAYMAST) OBJTYPE(*FILE) USER(DEVOPS01) AUT(*OBJMGT) - Let the object's owner, or a security officer, run the command instead, if the user shouldn't manage the object at all.
- Prefer group profiles or authorization lists over grants to single users.
- Check the library too. Rename and move commands also need authority to the library, and that failure is CPF2182.
What it looks like
Not authorized to object PAYMAST in ACCTLIB type *FILE.
IBM documentation
IBM Display Message Descriptions (DSPMSGD). Use the documentation for your installed release.
This link opens the relevant IBM reference library or lookup instructions. Match the complete code and your installed product release; it is not a code-specific review.
Read the installed message description:
DSPMSGD MSGID(CPF2189) MSGF(QSYS/QCPFMSG)
Also inspect the full job log and second-level message text, including substitution values.
Related codes
Questions
What is the difference between CPF2189 and CPF9802?
They mean the same thing. CPF2189 comes from library and object commands such as RNMOBJ and gives the object type, and CPF9802 comes from commands such as CHKOBJ.
I have *CHANGE authority to the file. Why can't I rename it?
Renaming needs object management authority, and *CHANGE doesn't include it. You can change every record and still be refused the rename.
Can I just give the user *ALLOBJ?
That gets past the message but gives the user every object on the system. Grant the single right the command needs instead.