2 Replies Latest reply: Jan 11, 2009 2:30 PM by ZXC
ZXC Level 2 Level 2 (180 points)

I'm trying to edit or remove a known_hosts file in my .ssh folder, but have no idea how I can find that folder.

Someone suggested a command I could use in Terminal, but when I tried, I got the message that I didn't have the permission. Repairing permissions didn't help.

The reason I need to do this, i sthat I get the following message when trying to log in via SSH to a shared server:

The RSA host key for********.com has changed,
and the key for the corresponding IP address **************
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /Users/*********/.ssh/known_hosts to get rid of this message.
Offending key in /Users/*******/.ssh/known_hosts:1
RSA host key for************** has changed and you have requested strict checking.
Host key verification failed.

[Process completed]


Any advice would be highly appreciated.

8-core Mac Pro 2.8ghz, Mac OS X (10.5.6), 8x1g RAM
  • BobHarris Level 6 Level 6 (15,090 points)
    From the Finder:

    Finder -> Go -> Go to Folder...

    and enter


    which is tilda slash .ssh

    If you want to use the Terminal, then you would

    cd ~/.ssh
    nano known_hosts

    You can use something like TextEdit, TextWrangler, Smultron to edit the file. If using the terminal you can use nano, vi, vim, emacs to edit the file.

    The only problem with some of these editors is finding an explicit line. As I seem to recall, the known_host file message gives a line number. Since the lines in the known_hosts file are very long, a lot of these editors line wrap so just counting visible lines is not accurate.

    Message was edited by: BobHarris
  • ZXC Level 2 Level 2 (180 points)
    Thanks a lot.... The Go To Folder menu (which I've never used - after all these years on the Mac!) did the trick, unlike Spotlight (as expected), attempts with Terminal or using the search field inside the normal/visible folders. I found several people with a similar situation when Googling, but nobody mentioned this simple methods. Thanks again!