IBM i Global

IBM i Global

Connect, learn, share, and engage with IBM Power.

 View Only
Expand all | Collapse all

CL Reset Password

  • 1.  CL Reset Password

    Posted Fri September 01, 2023 11:36 AM
      |   view attached

    Hello,  

    I have a CL program that will allow a user to reset their password. I'm getting an error  that it doesn't like the &USRPRF that I have declared in the program. It wants an actual user profile name coded in there. So any ideas how to fix this? Document attached showing the error.

    DCL        VAR(&USRPRF) TYPE(*CHAR) LEN(10) 

    CHGUSRPRF  USRPRF(&USRPRF)   PASSWORD(CAKE4LUNCH) +

                 STATUS(*ENABLED)   PWDEXP(*YES)

    ERROR:



    ------------------------------
    Michael Ruth
    ------------------------------

    Attachment(s)

    docx
    PASSWORD RESET CL.docx   76 KB 1 version


  • 2.  RE: CL Reset Password

    Posted Tue September 05, 2023 09:45 AM

    Michael,

    How is the &USRPRF parameter getting passed to the CL? Are you including it at the PGM line like this?

    PGM PARM(&USRPRF)

    I also cannot see the error screenshot.



    ------------------------------
    Matt Seeberger
    Power i Engineer
    CMA Technology Solutions
    ------------------------------



  • 3.  RE: CL Reset Password

    Posted Tue September 05, 2023 11:05 AM

    I think the general concept you are trying is to set their password to some default and have it set to expired to force them to change it.

    There are a lot of rules on CHGUSRPRF.  For example

    CPF2292 - *SECADM required to create or change user profiles.  So you have to have the program adopt authority.  This applies even to their own user profile.

    Also, if I run this, and their password was already set to this, it will not change their "date password last changed":  CHGUSRPRF USRPRF(DUMMY) PASSWORD(CAKE4LUNCH) .  This I know because of one user here... (they no longer have access to IBM i).

    Have you thought about just using CHGPWD instead?



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 4.  RE: CL Reset Password

    Posted Tue September 05, 2023 11:17 AM

    I thought about this further.   I think you're in this scenario:

    User forgets their password.

    Helpdesk has a special adopted authority program which changes the password to a known default and sets it to must be changed upon signon.

    However your program isn't working.

    Possibly it is because CHGUSRPRF doesn't allow a parameter value for USRPRF?

    No sweat.  Wrap the whole command into a string 

    DCL &CMD CHAR(150)

    DCL &CMDLEN DEC(15 5) VALUE(150)

    CHGVAR &CMD 'CHGUSRPRF USRPRF(' *TCAT &USRPRF *TCAT ') PASSWORD(CAKE4LUNCH)'

    CALL PGM(QCMDEXC) PARM((&CMD) (&CMDLEN))



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 5.  RE: CL Reset Password

    Posted Wed September 06, 2023 03:23 AM

    Hi,

    basically this program works. most of the time, it failes, because the password does not match the systems password rules.

    pls check your sysvals QPWD* for how the password needs to be set. (probably the last 32, same character position .. etc,

    Regards

    Markus Avogaro



    ------------------------------
    Markus Avogaro
    ------------------------------



  • 6.  RE: CL Reset Password

    Posted Wed September 06, 2023 09:07 AM

    I do not believe that CHGUSRPRF cares a whit about the password rules.  CHGPWD does, but not CHGUSRPRF.

    The following password does not meet our rules.  It's monocase.  No special characters.  No numbers, etc.

    CHGUSRPRF USRPRF(DUMMY) PASSWORD(BEARSSUCK)

    It gives a warning but I can log on as the new password.
    CPI22AE - Password does not meet all password rules.
    Severity . . . . . . . :   10
    Message type . . . . . :   Information



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 7.  RE: CL Reset Password

    Posted Thu September 07, 2023 02:43 AM

    Hi Rob.

    I do not believe that CHGUSRPRF cares a whit about the password rules.  CHGPWD does, but not CHGUSRPRF.

    When system value QPWDRULES contains *ALLCRTCHG, even CRTUSRPRF and CHGUSRPRF commands will have to comply to the password rules defined in QPWDRULES.

    Best regards,

    Christian



    ------------------------------
    Christian Jorgensen
    IT System Administrator
    Network of Music Partners A/S
    ------------------------------



  • 8.  RE: CL Reset Password

    Posted Thu September 07, 2023 07:12 AM

    >>>> When system value QPWDRULES contains *ALLCRTCHG, even CRTUSRPRF and CHGUSRPRF commands will have to comply to the password rules defined in QPWDRULES. <<<<

    Just to provide a formal reference for Christian's statement above which is available here :  Password Rules (QPWDRULES)  at  https://www.ibm.com/docs/en/i/7.5?topic=passwords-password-rules-qpwdrules     This is a long text. Do a Ctrl+F with "chgusrprf" and it will take you to the relevant information.



    ------------------------------
    Chance favors only the prepared mind.
    -- Louis Pasteur
    ------------------------------
    Satid S.
    ------------------------------



  • 9.  RE: CL Reset Password

    Posted Mon September 18, 2023 01:01 PM

    Satid,

    This shouldn't be rocket science, it's basic Cl programming 101. I have been trying to FTP previous CL programs from one server to another but I am unable to move it into PDM or the QCLSRC file. Help!!



    ------------------------------
    Michael Ruth
    ------------------------------



  • 10.  RE: CL Reset Password

    Posted Mon September 18, 2023 01:43 PM

    Are you limited to green screen tools or can you use RDi or any other tool?  If you can, then just Save As to the other system.

    There's also this

    ftp otherlpar

    namefmt 1

    bin

    put /qsys.lib/rob.lib/qclrob.file/mycl.mbr /qsys.lib/rob.lib/qclrob.file/mycl.mbr

    quit



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 11.  RE: CL Reset Password

    Posted Mon September 18, 2023 03:31 PM

    Robert

     

    The format you provided doesn't work,

    put /qsys.lib/rob.lib/qclrob.file/mycl.mbr /qsys.lib/rob.lib/qclrob.file/mycl.mbr

    Results:

     

     

    Michael Ruth

    iSeries Support – SiteOps IT North American MQ & RD

     

     

    CONFIDENTIALITY NOTICE: This email message (including all attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, copying or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

    PRIVACY NOTICE: Your privacy is important to us. To find out more about the information that Elanco may collect, how we use it, how we protect it, and your rights and choices with respect to your Personal Data, go to privacy.elanco.com

     






  • 12.  RE: CL Reset Password

    Posted Mon September 18, 2023 03:35 PM

    Michael,

    You forgot a command that I had in my example in between the ftp and the put command.  If you had put that command in you definitely would not have received that error.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 13.  RE: CL Reset Password

    Posted Mon September 18, 2023 03:40 PM

    If you want to know more about that particular command you could type in:

    ftp otherlpar

    sign in

    help

    and position on that command and it will tell you more.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 14.  RE: CL Reset Password

    Posted Mon September 18, 2023 03:46 PM

    Here's what I put in, so what did I miss?

     

    ftp otherlpar

    namefmt 1

    bin

    put /qsys.lib/rob.lib/qclrob.file/mycl.mbr /qsys.lib/rob.lib/qclrob.file/mycl.mbr

    quit

     

     

    Michael Ruth

    iSeries Support – SiteOps IT North American MQ & RD

     

     

    CONFIDENTIALITY NOTICE: This email message (including all attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, copying or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

    PRIVACY NOTICE: Your privacy is important to us. To find out more about the information that Elanco may collect, how we use it, how we protect it, and your rights and choices with respect to your Personal Data, go to privacy.elanco.com

     






  • 15.  RE: CL Reset Password

    Posted Mon September 18, 2023 03:55 PM

    namefmt 1

    If that executed successfully you would not have received that message.  Definitely.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 16.  RE: CL Reset Password

    Posted Mon September 18, 2023 03:56 PM

    I got it to work, thanks

     

    Michael Ruth

    iSeries Support – SiteOps IT North American MQ & RD

     

     

    CONFIDENTIALITY NOTICE: This email message (including all attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, copying or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

    PRIVACY NOTICE: Your privacy is important to us. To find out more about the information that Elanco may collect, how we use it, how we protect it, and your rights and choices with respect to your Personal Data, go to privacy.elanco.com

     






  • 17.  RE: CL Reset Password

    Posted Mon September 18, 2023 04:34 PM

    When I run the command, RESETPWD, I get an error message that it doesn't like this CMD and PARM in this CL program

     

     

     

    Michael Ruth

    iSeries Support – SiteOps IT North American MQ & RD

     

     

    CONFIDENTIALITY NOTICE: This email message (including all attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, copying or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

    PRIVACY NOTICE: Your privacy is important to us. To find out more about the information that Elanco may collect, how we use it, how we protect it, and your rights and choices with respect to your Personal Data, go to privacy.elanco.com

     






  • 18.  RE: CL Reset Password

    Posted Mon September 18, 2023 09:32 PM
    Because thar is not a CL program.
    That is a command. Try CRTCMD to compile it.

    Sent from my Verizon, Samsung Galaxy smartphone
    Get Outlook for Android





  • 19.  RE: CL Reset Password

    Posted Tue September 19, 2023 07:11 AM

    For more information about CL commands versus CL programs read the following:

    https://www.ibm.com/docs/en/i/7.5?topic=commands-defining-cl

    CRTCMD allows you to create your own command objects (*CMD).  There's really only a few options to the whole thing to make those prompted screens with choices and all that you see when you type in a command and hit F4.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 20.  RE: CL Reset Password

    Posted Tue September 19, 2023 10:38 PM
    Edited by Satid Singkorapoom Tue September 19, 2023 10:40 PM

    Michael 

    When you see an error message in your job log, you should move the screen cursor to that message line and press F1 to browse details of the messsage and you should see the following detail :

    You should see that the detail suggests you run DSPCMD to see the setting allowed for the command object to run. 



    ------------------------------
    Chance favors only the prepared mind.
    -- Louis Pasteur
    ------------------------------
    Satid S.
    ------------------------------



  • 21.  RE: CL Reset Password

    Posted Thu September 07, 2023 08:18 AM

    Thank you.  I did not notice that one.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------