Net::SSH::Expect SSHAuthenticationError Login timed out.

B

bsingh

I get the following error even though it is clearly connecting. Any
amount of timeout is not helping.
How do I avoid this exception? Thank you.

SSHAuthenticationError Login timed out. The input stream currently has
the contents bellow: Last login: Fri Jan 8 20:20:46 2010 from
gildb118.flowserve.net
at /cygdrive/c/Data/perl_mods/lib/Expect.pm line 828
at /cygdrive/c/Data/perl_mods/lib/Net/SSH/Expect.pm line 209
Net::SSH::Expect::__ANON__[/cygdrive/c/Data/perl_mods/lib/Net/
SSH/Expect.pm:212]('ARRAY(0x10530758)') called at /cygdrive/c/Data/
perl_mods/lib/Expect.pm line 828
Expect::_multi_expect(1, 'ARRAY(0x105308d8)', 'ARRAY
(0x10530ae8)') called at /cygdrive/c/Data/perl_mods/lib/Expect.pm line
565
Expect::expect('Expect=GLOB(0x10576940)', 1, 'ARRAY
(0x105776c0)', 'ARRAY(0x10530218)', 'ARRAY(0x10530338)', 'ARRAY
(0x10530458)', 'ARRAY(0x10530590)') called at /cygdrive/c/Data/
perl_mods/lib/Net/SSH/Expect.pm line 580
Net::SSH::Expect::_sec_expect('Net::SSH::Expect=HASH
(0x10517c08)', 1, 'ARRAY(0x105776c0)', 'ARRAY(0x10530218)', 'ARRAY
(0x10530338)', 'ARRAY(0x10530458)', 'ARRAY(0x10530590)') called at /
cygdrive/c/Data/perl_mods/lib/Net/SSH/Expect.pm line 213
Net::SSH::Expect::login('Net::SSH::Expect=HASH(0x10517c08)')
called at netsshexpect.pl line 13

Here's the code
------------------------------------------
use Net::SSH::Expect;

my $ssh = Net::SSH::Expect->new (
host => $host,
password=> $pwd,
user => $usr,
raw_pty => 1,
timeout => 10
);

my $login_output = $ssh->login();


# disable terminal translations and echo on the SSH server
# executing on the server the stty command:
$ssh->exec("stty raw -echo");


my $cmd = "ls -l";
my $cmd_out;

$cmd_out = $ssh->exec($cmd);

print "\n";
 
C

C.DeRykus

I get the following error even though it is clearly connecting. Any
amount of timeout is not helping.
How do I avoid this exception? Thank you.

SSHAuthenticationError Login timed out. The input stream currently has
the contents bellow: Last login: Fri Jan  8 20:20:46 2010 from
gildb118.flowserve.net
 at /cygdrive/c/Data/perl_mods/lib/Expect.pm line 828
 at /cygdrive/c/Data/perl_mods/lib/Net/SSH/Expect.pm line 209
        Net::SSH::Expect::__ANON__[/cygdrive/c/Data/perl_mods/lib/Net/
SSH/Expect.pm:212]('ARRAY(0x10530758)') called at /cygdrive/c/Data/
perl_mods/lib/Expect.pm line 828
        Expect::_multi_expect(1, 'ARRAY(0x105308d8)', 'ARRAY
(0x10530ae8)') called at /cygdrive/c/Data/perl_mods/lib/Expect.pm line
565
        Expect::expect('Expect=GLOB(0x10576940)', 1, 'ARRAY
(0x105776c0)', 'ARRAY(0x10530218)', 'ARRAY(0x10530338)', 'ARRAY
(0x10530458)', 'ARRAY(0x10530590)') called at /cygdrive/c/Data/
perl_mods/lib/Net/SSH/Expect.pm line 580
        Net::SSH::Expect::_sec_expect('Net::SSH::Expect=HASH
(0x10517c08)', 1, 'ARRAY(0x105776c0)', 'ARRAY(0x10530218)', 'ARRAY
(0x10530338)', 'ARRAY(0x10530458)', 'ARRAY(0x10530590)') called at /
cygdrive/c/Data/perl_mods/lib/Net/SSH/Expect.pm line 213
        Net::SSH::Expect::login('Net::SSH::Expect=HASH(0x10517c08)')
called at netsshexpect.pl line 13

Here's the code
------------------------------------------
use Net::SSH::Expect;

my $ssh = Net::SSH::Expect->new (
            host => $host,
            password=> $pwd,
            user => $usr,
            raw_pty => 1,
            timeout => 10
        );

my $login_output = $ssh->login();


The Net::SSH::Expect doc shows a keyword search on the
login() output:

if ($login_output !~ /Welcome/) {
die "Login has failed....";
}

Did you forget to do that?
 
C

C.DeRykus

I get the following error even though it is clearly connecting. Any
amount of timeout is not helping.
How do I avoid this exception? Thank you.
SSHAuthenticationError Login timed out. The input stream currently has
the contents bellow: Last login: Fri Jan  8 20:20:46 2010 from
gildb118.flowserve.net
 at /cygdrive/c/Data/perl_mods/lib/Expect.pm line 828
 at /cygdrive/c/Data/perl_mods/lib/Net/SSH/Expect.pm line 209
        Net::SSH::Expect::__ANON__[/cygdrive/c/Data/perl_mods/lib/Net/
SSH/Expect.pm:212]('ARRAY(0x10530758)') called at /cygdrive/c/Data/
perl_mods/lib/Expect.pm line 828
        Expect::_multi_expect(1, 'ARRAY(0x105308d8)', 'ARRAY
(0x10530ae8)') called at /cygdrive/c/Data/perl_mods/lib/Expect.pm line
565
        Expect::expect('Expect=GLOB(0x10576940)', 1, 'ARRAY
(0x105776c0)', 'ARRAY(0x10530218)', 'ARRAY(0x10530338)', 'ARRAY
(0x10530458)', 'ARRAY(0x10530590)') called at /cygdrive/c/Data/
perl_mods/lib/Net/SSH/Expect.pm line 580
        Net::SSH::Expect::_sec_expect('Net::SSH::Expect=HASH
(0x10517c08)', 1, 'ARRAY(0x105776c0)', 'ARRAY(0x10530218)', 'ARRAY
(0x10530338)', 'ARRAY(0x10530458)', 'ARRAY(0x10530590)') called at /
cygdrive/c/Data/perl_mods/lib/Net/SSH/Expect.pm line 213
        Net::SSH::Expect::login('Net::SSH::Expect=HASH(0x10517c08)')
called at netsshexpect.pl line 13
Here's the code
my $ssh = Net::SSH::Expect->new (
           host => $host,
            password=> $pwd,
            user => $usr,
            raw_pty => 1 ho,
            timeout => 10
        );
my $login_output = $ssh->login();

The Net::SSH::Expect doc shows a keyword search on the
login() output:

        if ($login_output !~ /Welcome/) {
            die "Login has failed....";
        }

Did you forget to do that?

Also, I haven't used Net::SSH::Expect but setting the
ssh verbose option might provide some info about where
the login transaction fails or times out.


my $ssh = Net::SSH::Expect->new (
host => $host,
password=> $pwd,
user => $usr,
ssh_option => "-v -v -v",
...

There are also some expect debug settings that may
be useful at some point.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,965
Messages
2,570,148
Members
46,710
Latest member
FredricRen

Latest Threads

Top