Between Linux and Anime

Kind of like Schrodinger's Cat

“The host key for this server was not found, but another type of key exists.” When using sftp with dolphin/KIO

I’m halfway through my Cosfest X.1 event post, but I bumped into yet another funny issue while working today, so I’m gonna do another quick solve-it post here. If you ever had the following error message shown to you when attempting to access an sftp location via dolphin or KIO in general:

“The host key for this server was not found, but another type of key exists. An attacker might change the default server key to confuse your client into thinking the key does not exist. Please contact your system administrator.”

This might be for you. In particular if you have successfully ssh-ed into the target host before. Following the discussion here, it appears that the problem, in summary, is KIO not being able to recognize a particular (new?) format of specifying a host in the ssh known_hosts list (a bug which has been filed here). Fortunately there is a workaround – since KIO is unable to recognize the known_hosts entry that ssh produces, we simply need to get KIO to be the one to produce the entry.

Back up your ~/.ssh/known_hosts file, then open it with your favorite text editor. Find and remove the entries associated with the host you’re trying to sftp into. If you cannot find it you can just delete everything in the file – with the side effect that you will be prompted again to add the keys back the next time you ssh into a previously known location. When you’re done, open dolphin and attempt to sftp into your desired target location. It should prompt you to add the host’s key – just tell it yes and you should be able to log in successfully.

That’s it! From then on you should be able to direct ssh or sftp-via-KIO into the location whenever you want.

1117
Rate this post
Thanks!
An error occurred!


  • Facebook
  • Twitter
  • Identi.ca
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • RSS
  • Reddit

Previous

Smplayer UI hanging after update in OpenSUSE?

Next

Photoogling at Cosfest X.1 2011

15 Comments

  1. Thanks so much for this mate!

    KDE really needs to add a key management app instead of just falling over whenever something like this happens.

  2. Jason "moofang"

    My pleasure :)

  3. Martin

    Such an evident message – once you realise what the heck they’re talking about >:D
    Thanks pal!

  4. pollysanders

    Thanks for this post. Totally helped me!

  5. Timothee Groleau

    Thanks for that! Saved me tonight :)

  6. Alex

    2 years after, you are a life saver!

  7. Zaar

    Thanks! Helped me as well.

    The bug is still unfortunately in Kubuntu 13.04

  8. Dimitris

    Had the same problem in linux mint 14 with KDE. The problem is due to kio not being able to recognize ecdsa ssh keys (the new prefered type of keys). So even though you have setup your .ssh/config and can connect through command line just fine, dolphin fails to do so. I managed to work around the problem in a much simpler way. In dolphin’s address bar just type in fish://myserver/ instead of sftp://myserver/ . Set up your ~/.ssh/config to store all details such as real host name, port, username and ssh key to use. That way you don’t need to change any keys in known hosts or the server. Hope this helps.

  9. Anutosho

    KDE’s KIO is really a remarkable piece of shit, and obviously nobody cares. It has cost me hours and days of my life with all kinds of errors and flaws, not only the ssh thing.

  10. The bug has been fixed in libssh 0.6.0 – when it ships with the next distribution, it will work.

  11. Someone with the same problem

    A quick workaround until the issue is fixed is to remove the key using ssh-keygen:

    ssh-keygen -R hostname

    From:
    http://askubuntu.com/questions/20865/is-it-possible-to-remove-a-particular-host-key-from-sshs-known-hosts-file

  12. Silly Linux User

    I hit this problem in libssh 0.6.3. Dimitris seems to be correct about the ECDSA compatibility.

  13. Marcelo

    Just saved a life. Congrats!

Leave a Reply

Powered by WordPress & Theme by Anders Norén