[Ssh-sftp-perl-users] Help using Net::SSH::Perl with automatic authentication
Brought to you by:
dbrobins
From: Eduardo R. A. <er...@gm...> - 2011-12-08 17:17:43
|
Hi everyone! I hope this list is still active as I just can't find any help on this. (And this is my first time ever on mailing list!) I'm trying to ssh to a remote machine inside a Perl script with automatic/non-interactive authentication. All machines have keys copied so that when I ssh through an xterm I don't get prompted for a password and I get logged in to the other machine without issues. Now, I want the same using Net::SSH::Perl. My code is as follows: my $ssh = Net::SSH::Perl->new( $host, 'protocol' => 2, 'debug' => 3, 'interactive' => 0, 'identity_files' => ["$ENV{'HOME'}/.ssh2/id_rsa_2048_a"], 'options' => [ "AllowedAuthentications publickey", "QuietMode yes", "StrictHostKeyChecking no", ] ); $ssh->login(); I'm getting at the end of the output (I'm removing Perl's paths for a shorter output) Trying pubkey authentication with key file '(home)/.ssh2/id_rsa_2048_a' Invalid key file type 'SSH2': Can't locate Data/Buffer.pm in @INC (...) at (...)/Crypt/DSA/Key/SSH2.pm line 71. BEGIN failed--compilation aborted at (...)/Crypt/DSA/Key/SSH2.pm line 71. Compilation failed in require at (eval 73) line 1. BEGIN failed--compilation aborted at (eval 73) line 1. at (...)/Net/SSH/Perl/Key/DSA.pm line 64 Under ~/.ssh2 I got id_rsa_2048_a and id_rsa_2048_a.pub, When I try the .pub version I get "Loading private key failed" so I'm guessing Net::SSH::Perl needs the private key to sign the answer to the challenge the server sends (I'm not too skilled with ssh authentication so I may be totally wrong). I also noticed I don't have configuration files under /etc/ssh/ssh or ~/.ssh but under /etc/ssh/ssh2 and ~/.ssh2 and I noticed on the output it's trying to read the ssh versions but not the ssh2 versions, maybe the problem is around there. Anyway, am I missing something here? Am I using the right key? Can someone enlighten me please? Thanks in advance for any help you can provide :) -- ɐʇsoɔɐ zǝɹıɯɐɹ opɹɐnpǝ "Mas tú, Jehová, eres escudo alrededor de mí; Mi gloria, y el que levanta mi cabeza." Salmo 3:3 |