Would be useful to have a password change utility, like the standard Unix passwd.
The easiest way to implement such a tool would be to use QSYCHGPW using _PGMCALL.
Helpfully, the API takes in CCSID arguments for both old and new passwords, so we can pass in 1208 (or the output of Qp2paseCCSID).
When run as root, passwd doesn't prompt for the old password. The API does support this by passing *NOPWD, for the old password, but the user would need *SECADM special authority. We could check for this with #11 then not prompt.
Would be useful to have a password change utility, like the standard Unix
passwd
.The easiest way to implement such a tool would be to use QSYCHGPW using _PGMCALL.
Helpfully, the API takes in CCSID arguments for both old and new passwords, so we can pass in 1208 (or the output of Qp2paseCCSID).
When run as root,
passwd
doesn't prompt for the old password. The API does support this by passing*NOPWD
, for the old password, but the user would need*SECADM
special authority. We could check for this with #11 then not prompt.