Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Net SSH2 auth_publickey not working in Windows

by taiko (Sexton)
on Feb 29, 2016 at 11:32 UTC ( [id://1156434]=note: print w/replies, xml ) Need Help??


in reply to Net SSH2 auth_publickey not working in Windows

I experienced exactly same problem. How I resolved it is following.

1. Generated SSH-2DSA dsa.pub and dsa.ppk with puttygen on Windows

2. Converted dsa.ppk to openssh.ppk ( Conversion-> Export OPENSSH key) in puttygen

3. Loaded openssh.ppk and saved openssh.pub from Key window in puttygen

4. copied content openssh.pub to authorised_keys on server and on local windows computer

5. Voila

my $ssh2 = Net::SSH2->new(trace => -1); #$ssh2->debug(1); $ssh2->connect('server_ip') or die $!; print $ssh2->error; $ssh2->auth_publickey('username','openssh.pub','openssh.ppk') or die + "$!\n"; my $chan = $ssh2->channel(); $chan->blocking(0); $chan->exec('ls -al'); my @output; while (<$chan>) { print $_; }
works with no problems

Log In?
Username:
Password:

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

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

    No recent polls found