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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-24 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found