How is it possible to login as root with Perl script and used telnet.pm
Hi,
I write a perl script under UNIX/LINUX.
The aim of this script is to open a telnet session as ROOT.
To do this, I use the library telnet.pm under perl.
Following is my source code :
#!/usr/bin/perl
use Net::Telnet;
my $fh1,$fh2,$fh3;
$telnet = new Net::Telnet ( Timeout=>10, Errmode=>'die', Prompt=>'/\$ $/i');
$fh1 = $telnet->option_log("optionlog.txt");
$fh2 = $telnet->input_log("inputlog.txt");
$fh3 = $telnet->output_log("outputlog.txt");
$telnet->open('$HOST_IP');
$telnet->login('root', '');
print $telnet->cmd('ls');
When I run this script, I have the following message :
timed-out waiting for password prompt at MyScript.pl
But when I want to open a telnet session and login as root any password is needed !!!!
I don't understand what is happened ?
Can someone tell me how it is possible do this with telnet.pm under perl script ?
Best regards, @+, Manu
|