I’ve been attempting to use the Net::SSH module but can’t seem to get everything working. My perl program seems to be able to make the ssh connection to the machine I want, but I can’t run any commands to it. I’ve already set up a passphrase for an RSA key, which is being prompted for (I’ve tested this authentication on Putty and it works).

OpenSSH version 5.1p1
Perl v5.10.0 built for cygwin-thread-multi-64int
Module Net::OpenSSH 0.36
Windows XP Professional

The following is my code:
#filename: ingest.pl # start of Net::OpenSSH use Net::OpenSSH; my $host = '************'; my $port = '22'; my $user = 'root'; my $pass = '***********'; my $ssh = Net::OpenSSH->new($host); $ssh->error and die "couldn't establish connection: " . $ssh->error; $ssh->system("ls") or die "remote command failed: " . $ssh->error; my @ls = $ssh->capture("ls"); $ssh->error and die "remote ls command failed: " . $ssh->error;
This returns the following lines as the errors, for which I can’t seem to find any good support on. I appreciate your time and any suggestions you might have. Thankyou.

mm_receive_fd: no message header
muxserver_accept_control: failed to receive fd 0 from slave
ssh_msg_recv: read: header
muxclient: msg_recv
remote command failed: child exited with code 255 at ingest.pl line 209

In reply to Module Net::OpenSSH error child exited with code 255 by steelcarn99

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.