Brian Candler wrote:
> Kamal Ahmed wrote:
>> 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 <IP
>> address> (Net::SSH::HostKeyMismatch)
>> 
>> 
>> Is there a way to Ignore HostKeyMismatch ?
> 
> Yes - see Net::SSH::Verifiers::Null, which should be selected by 
> :paranoid=>false.
> 
> However, Net::SSH version 1.1.1 is ancient (May 2007), so if it doesn't 
> work as you expect, that's probably why. Net::SSH 1.1.4 is a year more 
> recent from the 1.x train, but if I were you I'd switch to Net::SSH 2. 
> The parameters to Net::SSH.start have changed, but I found that the rest 
> of my code worked fine.
> 
> Having said all that, it would be better simply to remove the offending 
> entry from .ssh/known_hosts. Net::SSH is telling you that the host 
> you're connecting to is different from the one you previously connected 
> to (which is true, since you reinstalled it)

I actually FOUND the solution:


 Net::SSH.start( value_hosts, USER, :password => PASS ,  :paranoid => 
false ) do|ssh |
                        # The rescue block is used to ignore the change 
in key and still login using ssh
                        begin
                        rescue Net::SSH::HostKeyMismatch => e
                          puts "remembering new key: #{e.fingerprint}"
                          e.remember_host!
                          retry

                        end

Thanks,
-Kamal.
-- 
Posted via http://www.ruby-forum.com/.