zhonghua has asked for the wisdom of the Perl Monks concerning the following question:
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----------------------------------------------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";
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
|
---|