These forums are read-only!
Net::SSH::HostKeyMismatch
  • Hi,

    Just bought a new 2nd slice and I've been following the automated rails install instructions from the wiki: http://wiki.slicehost.com/doku.php?id=automated_rails_install_and_deployment_with_deprec_capistrano

    However, I keep getting stuck on this error: Net::SSH::HostKeyMismatch

    It occurs when i try and run this command:

    $ cap setup_admin_account_as_root
    * executing task setup_admin_account_as_root
    * executing task setup_admin_account
    Enter userid for new user: deploy

    * executing "sudo grep '^deploy:' /etc/passwd || sudo /usr/sbin/useradd --shell=/bin/bash --create-home deploy"
    servers: ["208.78.98.225"]
    /usr/local/lib/ruby/gems/1.8/gems/net-ssh-1.1.1/lib/net/ssh/host-key-verifier.rb:47:in `process_cache_miss':
    fingerprint b2:08:06:da:70:42:36:6d:9e:42:d1:cf:18:22:73:f7 does not match for 208.78.98.225 (Net::SSH::HostKeyMismatch)
    from /usr/local/lib/ruby/gems/1.8/gems/net-ssh-1.1.1/lib/net/ssh/host-key-verifier.rb:38:in `verify'
    from /usr/local/lib/ruby/gems/1.8/gems/net-ssh-1.1.1/lib/net/ssh/lenient-host-key-verifier.rb:9:in `verify'
    from /usr/local/lib/ruby/gems/1.8/gems/net-ssh-1.1.1/lib/net/ssh/transport/kex/dh.rb:165:in `verify_server_key'
    from /usr/local/lib/ruby/gems/1.8/gems/net-ssh-1.1.1/lib/net/ssh/transport/kex/dh.rb:232:in `exchange_keys'
    from /usr/local/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/lifecycle/proxy.rb:60:in `__send__'
    from /usr/local/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/lifecycle/proxy.rb:60:in `method_missing'
    from /usr/local/lib/ruby/gems/1.8/gems/net-ssh-1.1.1/lib/net/ssh/transport/session.rb:182:in `exchange_keys'
    from /usr/local/lib/ruby/gems/1.8/gems/net-ssh-1.1.1/lib/net/ssh/transport/session.rb:143:in `kexinit'
    ... 59 levels...
    from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.4.1/lib/capistrano/cli.rb:12:in `execute!'
    from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.4.1/bin/cap:11
    from /usr/local/bin/cap:16:in `load'
    from /usr/local/bin/cap:16


    My first, and pretty much only assumption, is that my keys are failing, but I've tested them by logging in via ssh and I assume because I'm not promted for a password that the keys are good. I only have 2 users currently on the slice, root and an admin user. The keys seem to work for both.

    Can anyone say why I'm getting this error still?
  • The problem is with checking the server's host key against your .ssh/known_hosts file locally. Find and remove the invalid entry and the error should go away.
  • I remember a similar post a while ago - if I recall, cappy uses it's own cache (why, I have no idea) so you may need to clear that and try again.

    No idea where it keeps in though but it shouldn't be hard to find.

    PickledOnion.


    Edit: There you are, two answers for the price of one :)
  • hrmmm... something to try...

    ensure the correct hostname is listed in the /etc/hosts file on the slice.
    (sometimes it defaults to HOSTNAME) and can cause ssh issues when it is checking host fingerprints and the like.
  • Yay!

    Jason was right, when I checked .ssh/known_hosts there was already a line entered for my slice. This probably occurred on some previous attempt to get it working.

    To fix it I simply removed that line, saved the file, and re-ran cap.

    Thanks! On the to the next step...
  • I couldn't make it work, cleaned both local and remote know_hosts, wich weren't matching, but still the same problem… strange.
    so found it :

    ssh_options[:paranoid] = false

    to put in deploy.rb;
    well, maybe not the most secure but worked.