From: Walton Hoops Date: 2010-05-18T23:34:20+09:00 Subject: Re: (Net::SSH::HostKeyMismatch On 5/18/2010 5:22 AM, Kamal Ahmed wrote: > Hi, > > When trying to ssh login, to a host which has been reinstalled, using: > > Net::SSH.start( value_hosts, USER, :password => PASS , :paranoid => > false, :forward_agent => true ) do|ssh, err | > > > > > I am getting an error: > > /sw/lib/ruby/gems/1.8/gems/net-ssh-1.1.1/lib/net/ssh/host-key- > verifier.rb:47:in `process_cache_miss': fingerprint da: > 34:2e:a6:87:c4:c8:49:0e:a1:8e:39:fd:fc:ef:e7 does not match for address> (Net::SSH::HostKeyMismatch) > > > Is there a way to Ignore HostKeyMismatch ? > > Net::SSH.start( value_hosts, USER, :password => PASS , :paranoid => > false, :forward_agent => true ) do|ssh, err | > > > is not working, i.e the :paranoid => false does not seem to work. > > Any hint will be appreciated. > > What i am trying to accomplish is to login via ssh, even of the ssh > exchange key is no longer valid since the OS was reinstalled. > > > i found the following, post but even that does not work: > > in order to resolve the HostKeyMismatch, use following in irb: > > require 'rubygems' > require 'net/ssh' > include Net > > Net::SSH.start( '10.5.30.52', 'root', :password => 'password' , > :paranoid => false ) do|ssh| > > #puts "hello" > end > rescue Net::SSH::HostKeyMismatch => e > puts "remembering new key: #{e.fingerprint}" > e.remember_host! > retry > end > > > i get an error: > > > irb(main):001:0> Net::SSH.start( '10.5.30.52', 'root', :password => > 'password' , :paranoid => false ) do|ssh| > irb(main):002:1* #puts "hello" > irb(main):003:1* end > NameError: uninitialized constant Net > This is the important error. You forgot to require 'net/ssh'. (and possibly rubygems if your system requires it) > > Thanks, > -Kamal. >