Reputation: 163
Come back here with another perl + SSH problem.
Here is my situation:
I need to connect from a server A to a server B with SSH. Within this SSH connection, I need to make some SFTP connections beside other commands. Concerning the authentication, I need to use the public key authentication. All of that in a Perl script and both server A and B are windows.
Do you know any perl module matching these constraints?
I tried:
Extra question: I read that storing the private key (on server A in my case) is not safe at all (and I understand why), is there a way to avoid that?
Code:
my $ssh = Net::SSH::Perl->new("server-ip", identity_files => [ 'path-to-private-key' ], option => ["BatchMode yes"]);
$ssh->login('login');
Upvotes: 3
Views: 2288
Reputation: 10242
I am the author of Net::OpenSSH and Net::SSH::Any.
Net::SSH::Any does support public key authentication but there are a couple of hidden requirements:
"${path_to_private_key}.pub"
.Besides that, over the last couple of months I have been working on improving Net::SSH::Any and on the way fixing lots of important bugs on the underlying Net::SSH2 module and the libssh2 library. If you feel courageous, you may like to try the development version (you will need the git versions of the three packages, Net::SSH::Any, Net::SSH2 and libssh2).
I would really appreciate getting any feedback about it, specially when running under Windows.
Upvotes: 6