Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hi Monks -

From my Linux box I'm trying to use Net::SSH::Perl to run a command on a remote Windows box running OpenSSH-3.1 and the CygWin environment. From Linux if I do 'ssh -2 -l configadm <windows ip> "/bin/ls /"', everything works perfectly, so I would think the following code should also work:

#!/usr/bin/perl -w use Net::SSH::Perl; use strict; my $ip = "<windows ip>"; my $pw = "<password>"; my $user = 'configadm'; my $ssh = Net::SSH::Perl->new($ip, protocol=>2); my ($stdout, $stderr, $exit); eval { $ssh->login($user,$pw); ($stdout, $stderr, $exit) = $ssh->cmd('/bin/ls /'); }; if ($@) { die "@@@@@ failed login or command problem"; } print $stdout; exit 0;
The problem is that nothing ever comes back over the ssh session, so $stdout does not get populated. If I execute the same code against a unix box running openssh then everything works perfectly. So, I'm left with either a bug in Net::SSH::Perl, a bug in CygWin, or a bug in OpenSSH for windows or some combination. It works from the command line though, so where does that leave us?

--Mike

In reply to Net::SSH::Perl and protocol 2? by Anonymous Monk

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (6)
    As of 2014-07-29 23:47 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (229 votes), past polls