grom has asked for the wisdom of the Perl Monks concerning the following question:

Hello everybody!

I'm trying to establish a SSH connection between two windows servers using Net::SSH::Any. Why this module? It fits all my requirements (SFTP, keep-alive connection...) so I would love to keep going with this one.
Fact is, it works with password authentication but I need to use the key authentication now. First of all, I've generated a pair of public/private keys and converted them into OpenSSH. All using PuttyGen.

To test them, I tried with Putty and it works perfectly. When I tried with my perl script, it fails with "Authentication failed"

Here is my script:

use Net::SSH::Any; $instance = "myserver.mydomain"; $path = "C:\\Temp\\PrivateKey_openssh.ppk"; $ssh = Net::SSH::Any->new($instance, user => "mydomain\\mylogin", key_ +path => $path); $ssh->error and die $ssh->error; print "SSH connection accepted\n\n";
Does anyone see something I missed? Thanks!

Replies are listed 'Best First'.
Re: Usage of key authentication with Net::SSH::Any
by Corion (Patriarch) on Dec 10, 2013 at 09:34 UTC
      Hi,
      Thanks for your reply. I just used a portable edition of bitvise to generate a new key pair and exported them under OpenSSH format.

      Once generated, I put the public key in WinSSHD on the remote server. I tried with bitvise (private key put in its key manager), it worked. I tried with my script and it failed. (private and public key were in the correct folder. Keys are named exactly the same. Public on is just suffixed by ".pub")

      I'm on a windows env. so, unfortunately, I can't use ssh-keygen.

      Any other idea?
        (I'm the author of the previous message. Didn't see I wasn't logged yet)