Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Net SSH2 auth_publickey not working in Windows

by taiko (Sexton)
on Feb 29, 2016 at 11:32 UTC ( #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? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2022-01-18 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (53 votes). Check out past polls.

    Notices?