Friday, October 30, 2009

known_hosts for SSHKeychain

SSHKeychain is, if you're not familiar with it, a very convenient OSX app that sits in the menu bar and can create and maintain multiple automatic SSH tunnels, something I use a lot. I recently reinstalled my home server which caused its ssh fingerprint to be changed, so (because I'm lazy) I just deleted all my .ssh/known_hosts-files to stop SSH from complaining about it.

But for some reason SSHKeychain still refused to set up a tunnel to that server, with the unhelpful error message: "The tunnel has unexpectedly terminated repeatedly. It will not be restarted." From the terminal I had no problem connecting to said server with SSH, so I couldn't understand what was wrong.

But as it turns out, SSHKeychain uses the root account's known_hosts, located at /var/root/.ssh/known_hosts on OSX. And since my server had the wrong fingerprint it refused to connect. Deleting said known_hosts file of course fixed the problem!

1 comment: