Operating System - HP-UX
1831347 Members
3398 Online
110024 Solutions
New Discussion

Changing a list ofe users passwords

 
SOLVED
Go to solution
Marty Metras
Super Advisor

Changing a list ofe users passwords

We are going to do an Apps software upgrade on our Backup server and I need to change the passwords to the users that will be doing the testing.

I need a simple script to change a mess or user's passwoods form a list of users/passwords on our backupserver.

I thought I could use a simple scrip like this to do it but I get hung up on the passwd prompt for password . I thought this might be easier than resyncing the /etc/passwd file.

= = = = = = =
while read USERID PASSWORD
do
passwd $USERID
# some thing needed in here
done < /path/to/users/list.txt
= = = = = =

What am I missing?
Marty
The only thing that always remain the same are the changes.
5 REPLIES 5
RAC_1
Honored Contributor

Re: Changing a list ofe users passwords

Option 1 - Search the forums.

The passwd command can not be used the way you are trying it.

You can use expect tool for this. Get it from porting centre.

The osther option is using sam usermod.sam command.
It can be used as follows.

/usr/sam/lbin/usermod.sam -p "password" user_name.

The password has to be a encrypted password.
Like
/usr/sam/lbin/usermod.sam -p `echo "123abcdexy"|/usr/lbin/makekey` user_name.

Here the password is 123abcde and xy are salt chars required for encrypting the password.

Anil

There is no substitute to HARDWORK
Marty Metras
Super Advisor

Re: Changing a list ofe users passwords

Using the `echo "pass123xz"|/usr/lbin/makekey`
Will I still beable to let the users change the password with out them knowing the encrypting key? Or is that handled by the system.
This looks like I could use this im my script.
Marty
The only thing that always remain the same are the changes.
RAC_1
Honored Contributor
Solution

Re: Changing a list ofe users passwords

What usermod.sam does is change the user's password (encrypted)The password has to be 8 chars. (and two chars for salt)

Later on user can login with the password and change their password to whatevr they want.

Anil
There is no substitute to HARDWORK
Marty Metras
Super Advisor

Re: Changing a list ofe users passwords

Great!
That is just what I wanted to happen.
Marty
The only thing that always remain the same are the changes.
Shanmugasundaram_1
New Member

Re: Changing a list ofe users passwords

Hi,
After I change the password using the following command /usr/sam/lbin/usermod.sam -p `echo "123abcdexy"|/usr/lbin/makekey` user_name as given above, I tried passwd -f username command as I wanted the user to change the password at first logon.

I am able to login with the password set above and I get a old password menu for me type in the password and after I type in the password, I get the following message.

Your password has expired.
Choose a new password.
Changing password for sundpsp
Old password:
Sorry.
Login aborted due to no password.

Can Someone help me.