Weird problem with Net/SSH

Hi guys,

One of my applications uses SSH to authenticate the user. That is, in
order to log in to the system, the user inputs a username and password,
and the server checks those against itself using SSH. I do it like this:


def try_to_login
return false if self.password.nil?

  Net::SSH.start(AUTH_SERVER, self.username, self.password) {}
rescue Net::SSH::AuthenticationFailed
  return false

return true


Now, this works perfectly well on one server. I’m now migrating the
application to a different server. On the new server, that works
perfectly well from the commandline (Net::SSH.start raises
AuthenticationFailed if the password is wrong, and raises nothing
otherwise). However, when I try to run it within rails, or using the
model directly from script/console, I get this:

u =
u.username = ‘ohad’
u.password = ‘password’ # I get the same effect with my correct password

Net::SSH::Exception: could not settle on kex algorithm
negotiate' from /usr/lib/ruby/1.8/net/ssh/transport/session.rb:122:inkexinit’
from /usr/lib/ruby/1.8/net/ssh/transport/session.rb:94:in
initialize' from /usr/lib/ruby/1.8/net/ssh/transport/services.rb:121:inregister_services’
from /usr/lib/ruby/1.8/needle/lifecycle/singleton.rb:42:in
call' from /usr/lib/ruby/1.8/thread.rb:135:insynchronize’
from /usr/lib/ruby/1.8/net/ssh/session.rb:94:in initialize' from /usr/lib/ruby/1.8/net/ssh.rb:47:instart’
from ./script/…/config/…/config/…/app/models/user.rb:17:in

Threading issues, perhaps? Any ideas at all? (Perhaps a different way to
check the username and password? The server authenticates through
winbind, so I can’t use the shadow-file - but if there’s another good
way to check u/n and p/w… though I really like SSH for this because it
allows me to authenticate against a remote server)

Nevermind, this is solved in the latest version.

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