System Administration
Showing results for 
Search instead for 
Do you mean 

Reset password of 50 users trusted system

SOLVED
Go to Solution
Super Advisor

Reset password of 50 users trusted system

Hi ,

 

We have hpux 11iv2 , trusted system , i need to reset password of 50 users , i.e same passwd for all 50 users.

Also it must force them to change their passwords at first login .

 

Do we have any script for this ??

7 REPLIES
Valued Contributor

Re: Reset password of 50 users trusted system

[ Edited ]

Hi Zxcv,

You can try to do the above task with a for loop,

 

1. get the 50 user list from the password file and create a file that will have only the users name: (ex: 50_user_list.txt )

 

#---------------- Start Script -------

# Script for changing 50 users password , with same password.

for user in `cat 50_user_list.txt`

do

passwd $user   

done

 

# Forcing passowrd to change at next logon:

for user in `cat 50_user_list.txt`

do

passwd -f $user   

done

echo " Done.."

#---------------------------------- End Script ---------------------------

 

 

-While executing this script , writedown the password in the putty screen and select it with the mouse , so that it will be in the buffer, by pressing the right click it will be pasted when it will ask for a password.

-If you select the password from text screen with a carriage return, you dont even  need to press enter  , just press 50 times right click when prompted for password.

 

-

 

 

Hth

Acclaimed Contributor Acclaimed Contributor

Re: Reset password of 50 users trusted system

To use a for-loop reading from a file, in a real shell you can do:

for user in $(< 50_user_list.txt); do

Super Advisor

Re: Reset password of 50 users trusted system

Hi guys,

 

Is there any option by means of which i can enter this hash value ( password )  in that script and i dont have to right click 50 times ?

Honored Contributor Honored Contributor

Re: Reset password of 50 users trusted system

For 11iv2 and older, this is undocumented by HP, but still a widely known procedure. (It was listed in HP-UX FAQ documents available in Internet more than 10 years ago.)

 

Find the hash value. For example, set the desired password to one user on one system, then read the hash value from the user's password file (/tcb/files/auth/<first letter of username>/<username>)

 

Then replace this line in RAJD1's script:

passwd $user

 

with this line:

/usr/sam/lbin/usermod.sam -p "<hashvalue>" $user

 Replace the string <hashvalue> with the actual hash value.

MK
Super Advisor

Re: Reset password of 50 users trusted system

Thnaks Matti

Valued Contributor

Re: Reset password of 50 users trusted system

Correction: <in my first post> in the script

 

for user in 50_user_list.txt  -->

-->  should be -->   for user in `cat 50_user_list.txt`

 

 

Cheers,

Raj.

Highlighted
Acclaimed Contributor Acclaimed Contributor

Re: Reset password of 50 users trusted system

>Correction: <in my first post> in the script

 

You can use the Post's Options > Edit Reply to change your post.

Also better to remove evil cat, as showed above.  :-)