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

Discussion in 'Perl Misc' started by scottdware, Mar 5, 2009.

  1. scottdware

    scottdware Guest

    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";
    }
    scottdware, Mar 5, 2009
    #1
    1. Advertising

  2. scottdware

    smallpond Guest

    On Mar 5, 10:36 am, scottdware <> wrote:
    > 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.
    smallpond, Mar 5, 2009
    #2
    1. Advertising

  3. scottdware

    scottdware Guest

    On Mar 5, 11:35 am, smallpond <> wrote:
    > On Mar 5, 10:36 am, scottdware <> wrote:
    >
    >
    >
    > > 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.


    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?
    scottdware, Mar 5, 2009
    #3
  4. scottdware

    scottdware Guest

    On Mar 5, 12:43 pm, scottdware <> wrote:
    > On Mar 5, 11:35 am, smallpond <> wrote:
    >
    >
    >
    > > On Mar 5, 10:36 am, scottdware <> wrote:

    >
    > > > 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.

    >
    > 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');
    scottdware, Mar 5, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    4
    Views:
    468
    Guest
    Oct 13, 2004
  2. Richard Hanson
    Replies:
    53
    Views:
    1,003
    Christos TZOTZIOY Georgiou
    Sep 29, 2004
  3. Gilles Ganault

    Compiling Python for uCLinux appliance?

    Gilles Ganault, Jul 29, 2009, in forum: Python
    Replies:
    1
    Views:
    350
    Diez B. Roggisch
    Jul 29, 2009
  4. Phillip Gawlowski

    A Ruby appliance: What would you include?

    Phillip Gawlowski, Dec 29, 2009, in forum: Ruby
    Replies:
    36
    Views:
    280
    Mark T
    Dec 29, 2009
  5. Replies:
    4
    Views:
    198
    Tad McClellan
    Jun 1, 2007
Loading...

Share This Page