Subject: | SSHAuthenticationError is a false positive error! |
Date: | Wed, 7 Apr 2010 20:47:59 +0200 |
To: | <bug-net-ssh-expect [...] rt.cpan.org> |
From: | Tebano epaminonda <l_epa_m_inonda [...] hotmail.com> |
Hi,
I'm trying to use the perl module Net::SSH::Expect.
I've tryed on many platforms; result is always the same:
SSHAuthenticationError Error: Bad password [@esx1:~[root@esx1 ~]# ] at /usr/perl5/site_perl/5.8.4/Expect.pm line 760
But how You can see from report of failed login,
[@esx1:~[root@esx1 ~]# ]
it wasn't failed!!!
Here the code I'm using:
---------------------------------------------------------------------------------------------------------------------------
#!/usr/bin/perl -w
# Esegui script distribuito
use Net::SSH::Expect;
# SOME VARIABLES
$linea = 0;
$miofile = "/tmp/listanodi";
$tuofile = "/tmp/script";
$user = "root";
$password = "password";
#
open(MYFILE, "$miofile") || die("cannot open user file /tmp/listanodi");
#
foreach $linea (<MYFILE>)
{
print $linea;
chomp($linea);
# -- set up a new ssh connection
my $ssh = Net::SSH::Expect->new(
host => "$linea",
password => "$password",
user => "$user",
raw_pty => 1,
timeout => 10
);
# -- authenticate
my $login_output = $ssh->login("$linea", "$user", "$password");
if ($login_output !~ /Last login/) {
die "Login has failed. Login output was $login_output";
};
$ssh->exec("stty raw -echo");
# -- execute the command
my($stdout, $stderr, $exit) = $ssh->exec("ls -l $tuofile");
};
close(MYFILE);
#
exit;
---------------------------------------------------------------------------------------------------------------------------
Into the block:
# -- authenticate
is the problem; Expect.pm line 760 report a failed login instead of a correct one, also if I try to bypass the problem saying "it's all right!"...
Distribution:
CPAN.pm: Going to build B/BN/BNEGRAO/Net-SSH-Expect-1.09.tar.gz
Perl v5.8.4
SunOS SunOS 5.11 snv_98 i86pc i386 i86pc
--------------------------------------------------------------------------------------------------------------------------
But I've tryed also on many Linux flavour, before try it on Solaris, without success (same problem!): Ubuntu 9.10; OpenSuse 11.2; Slackware 12.1
I say You that, because in these Linux ones, there are perl 5.10 and a release of Cpan higher than that one...
Can You help me?
Thanks.
cheers,
Tebano.
Show quoted text
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
https://signup.live.com/signup.aspx?id=60969