Mac OS X Remove SSH Known Host

by on December 15, 2007 · 5 comments· LAST UPDATED December 15, 2009

in

I've reinstalled Linux on remote server and now trying to connect it over ssh using Mac OS X:
ssh user@server1.example.com

But I'm getting an error which read as follows:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
5c:9b:16:56:a6:cd:11:10:3a:cd:1b:a2:91:cd:e5:1c.
Please contact your system administrator.
Add correct host key in /Users/user/.ssh/known_hosts to get rid of this message.
Offending key in /Users/user/.ssh/known_hosts:1
RSA host key for server1.example.com has changed and you have requested strict checking.
Host key verification failed.

How do I fix this problem under Mac OX X?

You need to run the following command to get rid of this problem. Open the terminal and type the following command:

ssh-keygen -R server-name
ssh-keygen -R server.ip.addre.ss
ssh-keygen -R 202.54.1.5
ssh-keygen -R server1.example.com
Fig.01: Removing /Users/user/.ssh/known_hosts file

Fig.01: Removing /Users/user/.ssh/known_hosts file

Now you can connect to remote host with ssh:

ssh user@server1.example.com
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 5 comments… read them below or add one }

1 Chichi Latté April 11, 2012 at 1:05 pm

Much appreciated Vivek, this worked for me no probs!

Reply

2 Bike Jerry December 30, 2012 at 4:45 pm

This helped me out as well – thank you, happy new year!

Reply

3 Craig May 28, 2013 at 8:26 am

Didn’t work for me, showed exactly what you said it would but when I try to SSH in it continues to show the original message… :-(

Reply

4 Ian July 21, 2013 at 11:29 am

Thanks for this. Had two ftp sites that Coda refused to connect to, but Cyberduck was happy with.

Reply

5 Hugo August 28, 2014 at 3:44 am

Worked great! Thank you!!

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: