Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

ssh with perl

by varalaxmibbnl (Acolyte)
on Sep 17, 2013 at 13:54 UTC ( #1054442=perlquestion: print w/ replies, xml ) Need Help??
varalaxmibbnl has asked for the wisdom of the Perl Monks concerning the following question:

hi monks when i run this script it gives error like (Can't locate Net/SSH/Perl.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at netssh.pl line 5. BEGIN failed--compilation aborted at netssh.pl line 5.) this.. please help me out to solve this problem...n i have installed Net ssh also ...thanks in advance..

#!/usr/bin/perl use strict; use warnings; use Net::SSH::Perl; my $host = 'localhost'; my $pass = 'yourpassword'; my $user = 'yourusername'; my $cmd = 'pwd'; my $ssh = Net::SSH::Perl->new($host, protocol => '1,2', debug => 1); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd($cmd); print $stdout, "\n";

Comment on ssh with perl
Download Code
Replies are listed 'Best First'.
Re: ssh with perl
by daxim (Chaplain) on Sep 17, 2013 at 14:00 UTC
    i have installed Net ssh also

    Net::SSH is not the same as Net::SSH::Perl. To make your code work, install Net::SSH::Perl.

      i have installed the foll 2lines also curl -L http://cpanmin.us | perl - --sudo App::cpanminus cpanm Net::SSH::Perl then alsi i get that error

        If you still "get that error" that means that Perl cannot find the files (just like Perl says). Find out where the file Net/SSH/Perl.pm lives, and correct the value of @INC so it includes the appropriate directory.

        I suspect that the installation of Net::SSH::Perl or one of its many dependencies fails on your operating system; as a result, the module actually did not get installed. To confirm this, please provide the full output of that cpanm command.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1054442]
Approved by Happy-the-monk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2016-02-14 22:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (471 votes), past polls