Changing an AIX password via script?

Grushton94 picture Grushton94 · Jan 8, 2015 · Viewed 108.1k times · Source

I am trying to change a password of a user via script. I cannot use sudo as there is a feature that requires the user to change the password again if another user changes their password.

AIX is running on the system.

unfortunately, chpasswd is unavailable.

I have expected installed, but I am having trouble with that also.

here is what I thought would work

echo "oldpassword\nnewpasswd123\nnewpasswd123" | passwd user

However once run the script I am prompted with please enter user's old password shouldn't they all be echoed in?

I am a beginner with shell scripting and this has been baffled.

Answer

Mandar Shinde picture Mandar Shinde · Jan 8, 2015

You can try:

echo "USERNAME:NEWPASSWORD" | chpasswd