Net::SSH is unable to use my RSA Key


M

Marco Schroeder

Hi all,

I'm currently using ruby 1.9.1p429 and net-ssh-2.0.23

When I try to use Net:SSH with the following example:
#!/usr/bin/env ruby
require 'net/ssh'
Net::SSH.start('examplehost', 'user', :password => "passwordtest") do
|ssh|
output = ssh.exec!("whoami")
puts output
end

it always throws me the following exception:
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/key_factory.rb:62:in
`initialize': Neither PUB key nor PRIV key:: nested asn1 error
(OpenSSL::pKey::RSAError)
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/key_factory.rb:62:in
`new'
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/key_factory.rb:62:in
`load_data_private_key'
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/key_factory.rb:39:in
`load_private_key'
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/authentication/key_manager.rb:113:in
`block in each_identity'
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/authentication/key_manager.rb:101:in
`each'
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/authentication/key_manager.rb:101:in
`each_identity'
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/authentication/methods/publickey.rb:19:in
`authenticate'
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/authentication/session.rb:68:in
`block in authenticate'
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/authentication/session.rb:61:in
`each'
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh/authentication/session.rb:61:in
`authenticate'
from
/usr/lib/ruby/gems/1.9/gems/net-ssh-2.0.23/lib/net/ssh.rb:183:in `start'

When I delete my id_rsa Key it asks me for password authentication and
then it works. But unfortunately not which pubkey authentication.

As far as I remember, in the past with ruby 1.8.6 that worked already.

Any hints would be appreciated.

Thanks,
Marco
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top