General
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to check Telnet Login in Hundred Servers !!

SOLVED
Go to solution
ezhilarasan_1
Occasional Advisor

Need to check Telnet Login in Hundred Servers !!

Hi,

I need to check if my unix userid is working
in hundreds of Unix server. The userid and password are same, but only host will be different.

Manually doing telnet login to all server is
very time consuming. So I try to hard code a single script to login. Then I try to rcp .profile to the local unix host with name as hostname_profile. Then exit, try to do same
way for next server and so on.

Can you please write a small unix script for this for one server (sample). Similar way I will do for all my servers.

Thanks
R.Ezhil
5 REPLIES
Con O'Kelly
Honored Contributor
Solution

Re: Need to check Telnet Login in Hundred Servers !!

Hi

You asked this question yesterday. See link:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x06fc4c65a6733c479b8a69dde43b3aeb,00.html

The simple answer is that you can't do this by passing variables (such as username & password)to telnet. It won't accept them.

If you click on the link Stefan posted, you'll find a very good solution to your problem using expect (see Rainer's post. Ivan provides the solution at the end of the thread using expect).

Hope this helps you.

Cheers
Con
Brian Crabtree
Honored Contributor

Re: Need to check Telnet Login in Hundred Servers !!

R. Ezhil,

They are correct, 'expect' is the one to use. There is a default program that is installed with 'expect' called 'passmass' that is built for what you are trying to do. If it does not exist on your server in /usr/local/bin, I would recommend doing a google search for it.

Thanks,

Brian
Michael Steele_2
Honored Contributor

Re: Need to check Telnet Login in Hundred Servers !!

If telnet won't allow automated login and passwords then why don't you use .netrc and ftp?

ftp HOST

$HOME/ftpuser/.netrc

(* Example of .netrc file *)

machine SERVER login USER password SECRET
quit


http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B9106-90011/B9106-90011_top.html&con=/hpux/onlinedocs/B9106-90011/00/00/74-con.html&toc=/hpux/onlinedocs/B9106-90011/00/00/74-toc.html&searchterms=netrc&queryid=20030808-202449
Support Fatherhood - Stop Family Law
blal
Frequent Advisor

Re: Need to check Telnet Login in Hundred Servers !!

Hi

u can create a shell script using ftp .
U should get at least all the ip address in one file.If any of ur sever's /etc/hosts file is updated with all hostnames you can extract the ip address from that hosts file to a test file in this case hosts.txt.


A sample script is given below.

#!/bin/sh

ftp_function (){
ftp -nv $a <user user password
get /etc/hosts hosts-${a}
bye
EOF
}

#above creates a function called ftp_function , and the function is executed for every ip address.

cat hosts.txt |while read a;do

ftp_function

done


Try it out.If this script stops when a login failure happens then u have to modify the script , for checking the ftp log in is success or not, this can be achieved by including checking of exit codes.

regds,
baiju
Live and let live.
A. Clay Stephenson
Acclaimed Contributor

Re: Need to check Telnet Login in Hundred Servers !!

I suspect that by far the easist method to do this is via the Net::Telnet Perl module. This would be trivially easy.

http://search.cpan.org/author/JROGERS/Net-Telnet-3.03/lib/Net/Telnet.pm
If it ain't broke, I can fix that.