Operating System - HP-UX
1753774 Members
7071 Online
108799 Solutions
New Discussion юеВ

Re: Change all users password (trusted system)

 
SOLVED
Go to solution
HAMOU
Advisor

Change all users password (trusted system)

Hi,
How can i change all the users password from a list of users in a trusted system.
Have you a script who can do it.

Best regards,

Mansour.
7 REPLIES 7
Michael Tully
Honored Contributor

Re: Change all users password (trusted system)

You wish to change all passwords on your system? About only way to do this would be to untrust the system and then trust it again.

# /usr/lbin/tsconvert -r

# /usr/lbin/tsconvert
All passwords will expire for all accounts and then all users will be asked to change their passwords. Either that or you would have to write an expect script to do it.

Is this what your after ?
Anyone for a Mutiny ?
Stefan Farrelly
Honored Contributor
Solution

Re: Change all users password (trusted system)

You just need to use the /usr/lbin/modprpw command, here is the manpage for it;

You can easily write a script to do it on all users, eg;

for i in $(cat )
do
modprpw .... $i
done

where is a file with a list of all your usernames to change.
Im from Palmerston North, New Zealand, but somehow ended up in London...
HAMOU
Advisor

Re: Change all users password (trusted system)

Thanks Stephan and Michael for your answers,
i think that the modprpw cde could help me.

Best regards,

Mansour.
HAMOU
Advisor

Re: Change all users password (trusted system)

Stefan,

Can you give the option of modprpw to change a password in a trusted system or can you help to do the script with a file (username:passwd)

Thanks,

Mansour.
Steven E. Protter
Exalted Contributor

Re: Change all users password (trusted system)

Here is a script that reads through a copy of the passwd file with the system users taken out.

It can run the modprpw command pretty easily.

Attached

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
Camel_1
Valued Contributor

Re: Change all users password (trusted system)

try this out .....

for i in `cat new_ids`
do
echo "--- Processing: "$i
export USERID=$i
init_pwd.exp
done


contents of init_pwd.exp

set timeout 10

spawn passwd "$env(USERID)"
expect "*sword:"
send "rogers1a\r"
expect "*sword:"
send "rogers1a\r"
expect "#"
HAMOU
Advisor

Re: Change all users password (trusted system)

Hi,

Here is what i want and i've got.
Thanks for all your solutions, it's work.

#! /bin/ksh
cat /rpt1/userfile | while read line
do
first=$(echo $line|awk -F: '{print substr($1,1,1)}')
S1=/tcb/files/auth/
S2=$(echo $line|awk -F: '{print $1}')
S3=$(echo $line|awk -F: '{print $2}')
S4=$(grep u_pwd $S1$first/$S2 | awk -F: '{print substr($2,7,2)}')
/usr/sam/lbin/usermod.sam -p `echo "$S3$S4" | /usr/lbin/makekey` $S2
done