Hi,

I want to use a script on Windows to execute some commands on Linux, then return the command results.

I put the Linux RSA identity file "id_rsa" under C: direcoty. And the following is my code:

---------------------clip-------------------------
#!/usr/bin/perl -w use strict; use Net::SSH::Perl; $ENV{HOME} = "C:"; my $host = "192.168.32.138"; my $user = "root"; my $passwd = "101010"; my %params = ( protocal => '2,1', # debug => '1' ); my $ssh = Net::SSH::Perl->new($host,%params); $ssh->login($user,$passwd); my ($stdout, $stderr, $exit) = $ssh->cmd("ls /home"); print "$stdout";
---------------------clip-------------------------

When I run this script, there are so many problems showed as following.

Can't locate Math/Pari.pm in @INC (@INC contains: c:/Perl64/site/lib c:/Perl64/lib .) at C:/Perl64/site/lib/Net/SSH/Perl/Util/SSH2MP.pm line 6, <GEN1> line 1.

BEGIN failed--compilation aborted at c:/Perl64/site/lib/Net/SSH/Perl/Util/SSH2MP.pm line 6, <GEN1> line 1.

Compilation failed in require at c:/Perl64/site/lib/Net/SSH/Perl/Util.pm line 56, <GEN1> line 1.

BEGIN failed--compilation aborted at c:/Perl64/site/lib/Net/SSH/Perl/Kex/DH1.pm line 10, <GEN1> line 1.

Compilation failed in require at c:/Perl64/site/lib/Net/SSH/Perl/Kex.pm line 6, <GEN1> line 1.

BEGIN failed--compilation aborted at c:/Perl64/site/lib/Net/SSH/Perl/Kex.pm line 6, <GEN1> line 1.

Compilation failed in require at c:/Perl64/site/lib/Net/SSH/Perl/SSH2.pm line 6, <GEN1> line 1.

BEGIN failed--compilation aborted at c:/Perl64/site/lib/Net/SSH/Perl/SSH2.pm line 6, <GEN1> line 1.

Compilation failed in require at c:/Perl64/site/lib/Net/SSH/Perl.pm line 52, <GEN1> line 1.

---------------------clip-------------------------

I try to use module Net::SSH to execute this idea, but I don't know how to handle the trust relationship between Windows and Linux.

coud you help me to check and resolve this problem? Or give me another idea for the communication between windows and Linux?

Thank you.

Best Regards,

Wei


In reply to Communication between Windows and Linux via Perl by zhonghua

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.