![Forrest logo](/images/logo.png)
ssh:known-hosts:remove
Removes a known host from the ~/.ssh/known_hosts file
$ ssh-keygen -R ${hostname}
try on your machine
The command ssh-keygen -R ${hostname}
is used to remove a specific host key from the known_hosts file in SSH. Here is a breakdown of the command:
ssh-keygen
: This is the command-line tool for managing SSH keys.-R
: This option specifies that we want to remove a host key from the known_hosts file.${hostname}
: This is a placeholder for the actual hostname that you want to remove from the known_hosts file. You need to replace${hostname}
with the specific hostname you want to remove.
When you run this command, it will remove the host key entry for the specified hostname from the known_hosts file. This can be useful when you encounter a warning about a changed or unknown host key when connecting to an SSH server, and you want to remove the old key to avoid further warnings.
Note: Be cautious when using this command, as removing the host key of a remote server can potentially make you vulnerable to man-in-the-middle attacks if the server's identity has indeed changed.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.