Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Connecting using Net-OpenSSH with public key instead of password

by Lotus1 (Vicar)
on May 31, 2016 at 22:19 UTC ( [id://1164648]=note: print w/replies, xml ) Need Help??


in reply to Connecting using Net-OpenSSH with public key instead of password

Hi NewMonk2Perl

The first thing I noticed is that you aren't calling new() the way the documentation shows. The host is either a string or a variable but not part of the hash. The options hash is the second parameter.

my $ssh = Net::OpenSSH->new($host, %opts); $ssh->error and die "Can't ssh to $host: " . $ssh->error

If fixing that doesn't solve your problems there is a debugging section at the end of Net::OpenSSH.

For instance, in order to activate all the debugging flags, you can use:
$Net::OpenSSH::debug = ~0;

Update:

Try changing just this one line in your program:

my $ssh = Net::OpenSSH->new( $host, user=>$user,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1164648]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found