Removing hosts from ssh's known_hosts file

by Matt Hamilton on Jul 11, 2008
Filed Under:

ssh stores keys for hosts it knows about in ~/.ssh/known_hosts. This is used to detect if a host has changed or compromised. However, recent ssh versions hash the hostname in this file, which is good for security but means you can't just go in and edit the known_hosts file if you want to remove an entry (e.g. the server has been re-built and it now has new keys).

The solution is to use ssh-keygen:

ssh-keygen -R hostname

will remove the keys for 'hostname' from your known_hosts file.

Commenting has now closed on this post.

Follow us

— via Twitter

Is proudly sponsoring #BlueLightCamp today. If you want to come talk Open Source content management @HammerToe is there #blcamp
last month