How to manage ssh host keys

Linux saves the ssh host keys in ~/.ssh/known_hosts. You can manage these ssh host keys with the command ssh-keygen.

Search for a specific host (in known_hosts):
ssh-keygen -F HOSTNAME

Remove a specific host:
ssh-keygen -R HOSTNAME

To add a new ssh host key you can use ssh-keyscan. This command print the ssh host key on the stdout. So we have to append this key to the known_hosts file.
ssh-keyscan -H HOSTNAME >> ~/.ssh/known_hosts

Posted on April 18, 2012, in Network, SSH and tagged . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: