I thought I'd throw this out there in case any of you are real "shell script wizards". You'd probably be able to crank this out in a heartbeat.

I'm using ksh. I need a script to do the following.

Prompt for and accept YOUR password as input.
Prompt for and accept a user id as input.
Prompt for and accept a new user password as input.
issue the following command: sudo /bin/passwd <userid>
Respond to the request of that command for entry of passwords.

The only "tricky" part is this...when you first issue the sudo /bin/passwd
command on our system, it prompts you for YOUR password. Then it prompts for the user's new password, and it prompts you again for the user's new password (to verify). So the first time you issue the command you're typing in 3 passwords.

If you issue the command again within a certain time period, you only have to enter the user's password (2x). The authorization to use the sudo command seems to linger for like 60 or 120 seconds or so, so if you have a mess of password changes to do you don't have to keep retyping your password.

The prompts for each are different, so if the script can read the prompt, it can tell which password is required.

For YOUR password the prompt is: Password:
For Their new password the prompt is: New Password:
For Their new password repeated the prompt is: Re-enter new password:

The script should just provide whichever password (supplied by the user) that is appropriate at that time.

I want any error messages (id doesn't exist, etc.) to continue to be echoed to the screen.

Anyone got the mad skillz?