perl qustion

Latest response

I wrote a simple Perl script try to make a connection to remote server and run command. But came up some message I don’t what is about.

 

Here is the Perl script:

 

#!/usr/bin/perl

 

use Net::SSH::Perl;

 

my $host = "127.0.0.1";

my $user = "me";

my $password = "pass";

 

#-- set up a new connection

my $ssh = Net::SSH::Perl->new($host);

#-- authenticate

$ssh->login($user, $pass);

#-- execute the command

my($stdout, $stderr, $exit) = $ssh->cmd("ls -l /home/$user");

 

and here is the error message:

 

Can't locate Net/SSH/Perl.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ssh_test.pl line 3.

BEGIN failed--compilation aborted at ssh_test.pl line 3.

Responses

You might have to install per-Net-SSH packages for this. Unfortunately these packages are not available officially from Red Hat.

 

One place you can look for them is at epel.

 

http://fedoraproject.org/wiki/EPEL

http://dl.fedoraproject.org/pub/epel/5/x86_64/repoview/letter_p.group.html

 

Look for perl-Net-SSH in the last link.

 

Please note that the above packages are not officially supported by Red Hat since it's not provided by Red Hat.