I need to automate some commands on a load balancer that allow me to get a couple levels deep to the right vendor shell. This involves telling the appliance to go into bash and then to run another tmos shell. Manually it looks like this:

-bash-4.1$ ssh 10.10.10.1 Password: Last login: Tue Sep 10 22:01:12 2013 from 10.10.10.1 bp>!bash [kburns@ssl01:Active] ~ #
The module seems to hang after attempting to run the !bash command. Here is the code.
#!/usr/bin/perl use Net::OpenSSH; my $host = "10.10.10.1"; my $USERNAME = "kburns"; my $PASSWORD = "xxxx"; my $ssh = Net::OpenSSH->new($host, user => $USERNAME, password => $PAS +SWORD, strict_mode => 0); $ssh->error and die "Couldn't establish SSH connection: " . $ssh->erro +r; $ssh->system({quote_args => 0}, "!bash") or die "remote command failed +: " . $ssh->error; print "finished bash\n"; #never gets here. it hangs $ssh->system({stdin_data => \@output}, "ls") or die "remote command fa +iled: " . $ssh->error; foreach $line (@output) { print "$line\n"; }

In reply to Net::OpenSSH Problem by kburns1969

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.