Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Telnet question,

Status
Not open for further replies.

umcterp

Technical User
Jun 17, 2003
3
0
0
US
I am using the following commands to connect to a Solaris server in order to run a couple of commands. The login response is simply login: . The prompt is [sun88]/prod/users/nnmuser/u24060>. I keep receiving a login timeout. Can someone help distinguish what might be going on?

$t = new Net::Telnet (Telnetmode => 0,
Input_Log => $filename,
Dump_Log => $dump);
$t->open ($hostname);
$t->login($username, $password);

 
Don't have time to lookup what "TelnetMode => 0" does, but I suspect that may be part of the problem or your prompt doesn't match the default prompt. Here is a portion of a program I have that works for a Solaris machine.
Code:
use Net::Telnet;
my $host = "myhost";
my $user = "myuser";
my $password = "mypassword";
my $prompt = "]#"; # adjust for your prompt
my (@data, $line);
my $t = new Net::Telnet(
                        Timeout     => '5',
                        Prompt      => "/$prompt/",
                        Dump_log    => 'dump.log',
                        Input_log   => 'input.log',
                        Output_log  => 'output.log',
                        );
$t->errmode('return');
$t->Net::Telnet::open($host);
$t->login(
          Name     => $user,
          Password => $password,
         );

$msg = $t->errmsg;
print "$msg \n" if ($msg);
@data = $t->cmd(String => 'uptime');
foreach $line (@data) {
     print "$line\n";
}
$t->close();
 
I'm not too sure I'd be using Telnet for this

Have you thought about utilizing SSH ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top