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

Having a problem w/ Net::SSH::Perl. I want it to run as close as possible to me running it on the terminal. In other words, try a simple login w/ the rsa keys. The problem is actually 2-fold I believe.
my @id_files = qw(/home/me/.ssh/id_rsa.pub); my $ssh = Net::SSH::Perl->new( 'host', debug => 1, protocol => 2, iden +tity_files => \@id_files ); $ssh->login() my ( $o, $e, $ex ) = $ssh->cmd( 'uptime' );
the main problem i get is this output.
host: Trying empty user-authentication request. host: Authentication methods that can continue: publickey,keyboard-int +eractive. host: Next method to try is publickey. host: Trying pubkey authentication with key file '/home/me/.ssh/id_rsa +.pub' host: Will not query passphrase for '/home/me/.ssh/id_rsa.pub' in batc +h mode. Loading private key failed.
I can assure you that the id_rsa.pub file is there. If I don't load @id_files implicitly, it seems to default to dsa keys, which will fail for almost all the machines I'm trying to talk to.

The other problem is there seems to be a lot of excess fluff going on that takes up time. "computing shared secret key", etc. Takes several seconds. I'll only be doing about 30 or so machines in off hours, but it would still be nice for it to work "quickly". I could just as easily use the system call to ssh, but it would probably get tricky when I get to a machine w/ a bad key... the input would be stuck on the password prompt. Don't want to deal w/ forking and whatnot with this. Cheers

Replies are listed 'Best First'.
Re: Net::SSH::Perl (RSA)
by zentara (Cardinal) on Mar 02, 2007 at 13:56 UTC
    host: Trying pubkey authentication with key file '/home/me/.ssh/id_rsa +.pub' host: Will not query passphrase for '/home/me/.ssh/id_rsa.pub' in batc +h mode. Loading private key failed.
    That sort of rings a bell. I know the tutorials I've seen for using keys auth, say to use a null password. The error you see above seems to indicate that it won't query for a password, then it fails. Did you create your keys with a null password?
    ssh-keygen -b 1024 -f identity -P '' -t dsa This ssh-keygen command creates a 1,024-bit (-b 1024) key pair called identity (-f identity) using the DSA algorithm (-t dsa). The private key is created with a null-passphrase (-P ''), which is important for automating the login process.

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
      Indeed the keys were not made with a null password, unfortunately. And, can't really change it now as it's in use on so many other machines.