Net::Appliance::Session error? or something else?

S

scottdware

Hello,

I am having trouble on some of my SSH scripts that are using the
Net::Appliance::Session module on a Unix (Solaris 9) box.

Basically, I keep getting the error:

"Login failed to remote host at line..."
"Pattern match time-out"

Can you see any reason as to why I am getting that? If I use this on
Cygwin, it works fine, but I don't know why it wouldn't work on Unix?

Here's a test script:

#!/usr/local/bin/perl

use strict;
use warnings;
use Net::Appliance::Session;

my $user = "username";
my $pass = "password";
my $host = "somehost.domain.com";
my $command = "show ip int brie";

my $ssh = Net::Appliance::Session->new(Host => $host, Transport =>
'SSH');

eval {
$ssh->connect(Name => $user, Password => $pass, SHKC => 0);
$ssh->cmd(String => $command, Timeout => 30);
sleep 2;
};

if (UNIVERSAL::isa($@, 'Net::Appliance::Session::Exception')) {
print $@->message ."\n";
print $@->lastline ."\n";
print $@->errmsg ."\n";
}
 
S

smallpond

Hello,

I am having trouble on some of my SSH scripts that are using the
Net::Appliance::Session module on a Unix (Solaris 9) box.

Basically, I keep getting the error:

"Login failed to remote host at line..."
"Pattern match time-out"

Can you see any reason as to why I am getting that? If I use this on
Cygwin, it works fine, but I don't know why it wouldn't work on Unix?

Here's a test script:

#!/usr/local/bin/perl

use strict;
use warnings;
use Net::Appliance::Session;

my $user = "username";
my $pass = "password";
my $host = "somehost.domain.com";
my $command = "show ip int brie";

my $ssh = Net::Appliance::Session->new(Host => $host, Transport =>
'SSH');

eval {
        $ssh->connect(Name => $user, Password => $pass, SHKC => 0);
        $ssh->cmd(String => $command, Timeout => 30);
        sleep 2;

};

if (UNIVERSAL::isa($@, 'Net::Appliance::Session::Exception')) {
        print $@->message ."\n";
        print $@->lastline ."\n";
        print $@->errmsg ."\n";



}


The login prompt is not matching what the module expects.
Read the "Important Notes ..." section of Net::SSH::Expect
documentation.
 
S

scottdware

The login prompt is not matching what the module expects.
Read the "Important Notes ..." section of Net::SSH::Expect
documentation.

Thanks. But why would the Net::SSH::Expect module come in handy here,
since I'm not using it? Does it pull from that as well?
 
S

scottdware

Thanks. But why would the Net::SSH::Expect module come in handy here,
since I'm not using it? Does it pull from that as well?

Ok, I figured it out. I had to specify the "App" parameter inside of
the connect constructor, and then it worked as intended:

$ssh->connect(Name => $user, Password => $pass, SHKC => 0, App => '/
usr/local/bin/ssh');
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top