Changing an AIX password via script?

2020-02-16 11:58发布

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.

13条回答
成全新的幸福
2楼-- · 2020-02-16 12:54

For me this worked in a vagrant VM:

sudo /usr/bin/passwd root <<EOF
12345678
12345678
EOF
查看更多
登录 后发表回答