[LIP] Automate password change

Pinku Hussain <pinkuh-/[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
Hi,

I have a shell script which automates the pasword
change in a number of machines. 

#!/usr/bin/sh
for SERVER in `cat hostlist`
do
(sleep 5;echo $userid;\
sleep 5;echo $password;\
sleep 2;echo passwd;\
sleep 5;echo $password;\
sleep 2;echo $new_passwd;\
sleep 2;echo $new_passwd;\
sleep 2;exit;) | telnet $SERVER
done

The script works fine for a normal userid. But the
script fails if I su to root to change the root
passwd. To login as root I need to get in as normal
user and su to root. I cannot use 'Expect Utility' as
I am not allowed to install anything. For example the
following script FAILS.

#!/usr/bin/sh
for SERVER in `cat hostlist`
do
(sleep 5;echo $userid;\
sleep 5;echo $password;\
sleep 2;echo su root;\
sleep 5;echo $root_password;\
sleep 5;echo passwd;\
sleep 5;echo $root_password;\
sleep 2;echo $new_passwd;\
sleep 2;echo $new_passwd;\
sleep 2;exit;) | telnet $SERVER
done

Can someone help me? Any pointer will be of help.

regards & Thanks
Pinku


	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.