Re: [LIP] Automate password change

Krishna Dagli <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
Pinku Hussain wrote:
> 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.

Not anywhere on computer?  Anyway you are doing everything on 
telnet (instead of ssh) then why even bother to do 'su' to change 
root password. Configure your machine/telnet server to directly 
allow root login.  Hope you are doing this for your local machines.

-Krishna.







-------------------------------------------------------
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.