System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the password of users

sujeet joshi
Frequent Advisor

Changing the password of users

Hi,

Want to change the more that 1000 users password using simple script or command for changing the same or is there any easiest way to change the password? and how?

Please help me...

Thanks
Sujeet
5 REPLIES
Rita C Workman
Honored Contributor

Re: Changing the password of users

Just type 'mass password change' into the SEARCH box above and you will find several threads, with scripts to do this for you.

Rgrds,
Rita
Manix
Honored Contributor

Re: Changing the password of users

modprpw -E -> to expire a passwd for trusted system

passwd -e, --expire ,to expire a passwd for
non trusted system

cat /etc/passwd | awk '{print $1}' > /tmp/passwd

for i in `cat /tmp/passwd`
echo $i
do passwd -e $i
or modprpw -E $i
done

such a simple shell script may do the trick !!

HP-UX been always lovable - Mani Kalra
Doug O'Leary
Honored Contributor

Re: Changing the password of users

Hey;

The attached script, mypwd, uses the expect module in perl (which has to be compiled for HPUX). It also assumes direct root access via secure shell/public key authentication.

Just execute it to get a list of options:

./mypwd

Old password must be set
Format: mypwd [ -u ${user} ] -o ${pwd} -n ${new_pwd} -h ${host} [ -f ]

If you specify a '-u' prompt, it'll change the password for that user. It defaults to root. If you specify a -f option, the user will be forced to change their password on their next access attempt.

The scipt works on HPUX, Solaris, and Linux.

So, back to your original question:

for h in $(cat list-o-hosts.txt)
do
for u in $(cat list-o-users.txt)
do
printf "%-8s %s\n" ${h} ${u}
mypwd -u ${u} -h ${h} -o old_passwd -n new_passwd -f
done
done

should do the trick for you.

Doug O'Leary

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Doug O'Leary
Honored Contributor

Re: Changing the password of users

Hey;

After four tries covering a few hours, I seem to be unable to upload the script. I'll try again tomorrow; but, can't promise that it'll work any better.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Doug O'Leary
Honored Contributor

Re: Changing the password of users

Yay! success. apparently, the files have to have an extension on them. Interesting constraint. Any rate, there it is.

Good luck.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html