script for changing passwords

Hello,
We are running aix 5.3.
We're looking for a script that can change passwords, taking 2 arguments ( old password, new password ).

I am wondering if this can be done with a here document, or some generic scripting method.
Or, if I would have to download expect.

Alternatively I wonder if there are any tools or OS commands I don't know about that can change passwords given arguments instead of the regular interactive password command.

Thank you,
Floyd

Well I hesitate to recommend it, but I did write a script that kinda cheats. link

Wooo, year 2003 script.

My way to change password on other servers is by ssh with keyless. ( with same operation system)

1) set the ssh with keyless to remote root account. So you can login other servers by ssh directly.

2) generate the new encrypted password on your local server, you can copy it from /etc/shadow

3) replace the old password on remote server by below command:

ssh root@server1 perl -i.bak -pe 's/encrypted_old_pw/encrypted_new_passwd/' /etc/shadow

Hey, 2003 was not that long ago. :stuck_out_tongue: I have two bottles of mustard and a jar of Tang that's older than that. Anyway my script does not require the user to be root.