Error using Net::SSH

A

Amit Chitre

From WinXP, I'm trying (for the first time) to connect to remote
solaris server. Code as under:

-------------------------
require 'net/ssh'

session = Net::SSH.start( 'remote.solaris.server', 'user', 'pwd' )

session.close
-------------------------

I get the following error message:

-------------------------
c:/amit/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.1/lib/net/ssh/userauth/pageant.rb:112:in
`initialize': pageant process not running (Net::SSH::Exception)
from c:/amit/ruby/lib/ruby/1.8/dl/import.rb:174:in `new'
from c:/amit/ruby/lib/ruby/1.8/dl/import.rb:174:in `new'
from
c:/amit/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.1/lib/net/ssh/userauth/pageant.rb:103:in
`open'
from
c:/amit/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.1/lib/net/ssh/userauth/agent.rb:70:in
`connect!'
from
c:/amit/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.1/lib/net/ssh/userauth/services.rb:54:in
`register_services'
from
c:/amit/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.1/lib/net/ssh/userauth/services.rb:40:in
`call'
from
c:/amit/ruby/lib/ruby/gems/1.8/gems/needle-1.2.0/lib/needle/service-point.rb:117:in
`instance'
from
c:/amit/ruby/lib/ruby/gems/1.8/gems/needle-1.2.0/lib/needle/container.rb:308:in
`[]'
... 8 levels...
from
c:/amit/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.1/lib/net/ssh/session.rb:120:in
`initialize'
from
c:/amit/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.1/lib/net/ssh.rb:47:in
`new'
from
c:/amit/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.1/lib/net/ssh.rb:47:in
`start'
from ssh1.rb:3
-------------------------

Any help would be greatly appreciated.

Thanks.

Amit
 
J

Jamis Buck

solaris server. Code as under:

Thanks for the bug report. I'll look into it--in the meantime, you
can work around it by explicitly specifying the authentication method
(s) to use:

session = Net::SSH.start('remote.solaris.server', 'user', 'pwd',
:auth_methods => %w(password keyboard-interactive))

(The problem is occurring because by default, the "publickey"
authmethod is tried first and it can't find the SSH agent to use for
that. That's a bug--it should silently fall back to the next method.)

- Jamis
 
A

Adam P. Jenkins

Jamis said:
Thanks for the bug report. I'll look into it--in the meantime, you can
work around it by explicitly specifying the authentication method (s) to
use:

session = Net::SSH.start('remote.solaris.server', 'user', 'pwd',
:auth_methods => %w(password keyboard-interactive))

(The problem is occurring because by default, the "publickey"
authmethod is tried first and it can't find the SSH agent to use for
that. That's a bug--it should silently fall back to the next method.)

Why does it need ssh-agent to use the publickey authentication method?
If your private key is encrypted and you don't have an ssh-agent
running, the ssh client should just prompt you for the private key
password. Or am I misunderstanding what you're talking about?

Adam
 
J

Jamis Buck

Why does it need ssh-agent to use the publickey authentication
method? If your private key is encrypted and you don't have an ssh-
agent running, the ssh client should just prompt you for the
private key password. Or am I misunderstanding what you're talking
about?

It doesn't--I was just trying to be brief in explaining the bug. What
it does (or rather, what it SHOULD be doing) is check to see if there
is an ssh-agent running, and if so, use that, otherwise, find the
private keys of the current user and read them directly.

Unfortunately, there is a problem right now, and what I believe is
happening is that it is trying to connect to an agent that isn't
running, because it is misinterpreting the result of the query to see
whether an agent is running.

Hopefully I'll have time to track this down sometime this week.
(Patches would be welcome, hint hint.)

- Jamis
 
Z

Zach Dennis

Jamis said:
It doesn't--I was just trying to be brief in explaining the bug. What
it does (or rather, what it SHOULD be doing) is check to see if there
is an ssh-agent running, and if so, use that, otherwise, find the
private keys of the current user and read them directly.

Unfortunately, there is a problem right now, and what I believe is
happening is that it is trying to connect to an agent that isn't
running, because it is misinterpreting the result of the query to see
whether an agent is running.

Hopefully I'll have time to track this down sometime this week.
(Patches would be welcome, hint hint.)

Jamis,

Any luck on this. I get this from the latest 1.0.2 gem. I looked at the
source, but I do not see where there is any code that would 'read' the
keys in, I only see where it attempts to use Pageant, and nothing else....

I would like to use the latest net-ssh with my key authentication w/o
using ssh-agent or pageant. Any ideas? Thanks,

Zach
 
J

Jamis Buck

Jamis,

Any luck on this. I get this from the latest 1.0.2 gem. I looked at
the source, but I do not see where there is any code that would
'read' the keys in, I only see where it attempts to use Pageant,
and nothing else....

I would like to use the latest net-ssh with my key authentication w/
o using ssh-agent or pageant. Any ideas? Thanks,

Zach,

Not having a windows box on which to do any decent testing on this,
it is hard for me to verify that a solution fixes the problem. If you
(or anyone else) were to identify the problem and present me with a
patch, I would gladly apply it, but my hands are rather tied, otherwise.

- Jamis
 

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

Members online

Forum statistics

Threads
473,757
Messages
2,569,543
Members
45,026
Latest member
camilin05

Latest Threads

Top