You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Access to .ssh/known_hosts

Hi,

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.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
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

Posted on Jan 11, 2009 1:10 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 11, 2009 1:43 PM

From the Finder:

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

and enter

~/.ssh

which is tilda slash .ssh

If you want to use the Terminal, then you would

cd ~/.ssh
ls
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
2 replies
Question marked as Top-ranking reply

Jan 11, 2009 1:43 PM in response to ZXC

From the Finder:

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

and enter

~/.ssh

which is tilda slash .ssh

If you want to use the Terminal, then you would

cd ~/.ssh
ls
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

Jan 11, 2009 2:30 PM in response to BobHarris

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!

Access to .ssh/known_hosts

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.