Operating System - HP-UX
1830465 Members
2656 Online
110005 Solutions
New Discussion

Password change for 500 users

 
SOLVED
Go to solution
Joyce Suganthy
Advisor

Password change for 500 users

Hi,

I need some help, i am having a trusted system and have almost 500 users in there.

I need to change the password of all these users. Is there any scripts in any of your keeping that does in a for loop, a user is picked up, then prompts for password, i key in the password, then it goes and pick the next user from the /etc/passwd file....prompt for password, i key in and then the process goes on...

Thanks

Regards
Joyce
3 REPLIES 3
Sanjiv Sharma_1
Honored Contributor
Solution

Re: Password change for 500 users

Steven E. Protter
Exalted Contributor

Re: Password change for 500 users

This utility script contains the code(maybe commented) that will help you get the job done.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven E. Protter
Exalted Contributor

Re: Password change for 500 users

This utility script contains the code(maybe commented) that will help you get the job done.

#!/sbin/sh

MINDAYS=7
MAXDAYS=61

useradd -D -g sag
useradd -D
# for user in `awk '{ FS=":"; print $1 $5 $6 }' /root/passwd'
# for user in `awk '{ FS=":"; print $1 $5 $6 }' /root/passwd`
for user in `awk '{ FS=":"; print $1 }' /root/passwd`
do
# $user=`awk '{ FS=","; print $1 }' $userstring`
# passwd -r file -n $MINDAYS -x $MAXDAYS $user
# echo "$user"
# passwd -f $user
passwd -x 48 $user
/usr/lbin/modprpw -l -k $user
# useradd -m $user
# echo "Command2: passwd -f $user "
done


SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com