Net::SSH is unable to use my RSA Key

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:innew’
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:inload_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:ineach’
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:inauthenticate’
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:ineach’
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:instart’

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs