Script for changing the password

Koul, Minoti koulmin at ugs.com
Wed Jun 22 01:33:18 EDT 2005


Hi Managers,
I am in a situation wherein I have to change root password of 100 odd
unix boxes. I wanted to do the same via a script.

I used to do it the crude way
#!/bin/ksh -x
cp -p /etc/shadow /etc/shadow.11
cat /etc/shadow|grep -v root>/tmp/shad1
echo "root:O75xmUttfitCw:12794::::::">>/tmp/shad2 ## here I am echoing
the encripted string for new password"
cat /tmp/shad1>>/tmp/shad2
cp /tmp/shad2 /etc/shadow
/usr/sbin/pwconv
chown root:sys /etc/shadow
chmod 400  /etc/shadow

I understand that we can input the new password via a script using !! .
But have'nt been able to do this successfully.
Can you please help out.



#####################################

MY NEW MOBILE  NUMBER: 9860092579

#####################################

Regards,

Minoti Koul

UGS - Pune, India

Direct: +91-20-22930635

Board:  +91-20-22930900

Cell:   +91-9860092579

E-mail: minoti.koul at ugs.com



More information about the sunmanagers mailing list