Mac OS X: Delete SSH Keys Using Terminal Command Line

Mac OS X: Delete SSH Keys Using Terminal Command Line

To delete an SSH key on macOS using the Terminal command line, you can use the ssh-keygen command with the -R option.

Here is the syntax for deleting an SSH key:

refer ‮‬to:lautturi.com
ssh-keygen -R hostname

Replace "hostname" with the hostname or IP address of the server for which you want to delete the SSH key.

For example, if you want to delete the SSH key for the server with the hostname "myserver", you can use the following command:

ssh-keygen -R myserver

This command will delete the SSH key from your local machine's known_hosts file, which is located at ~/.ssh/known_hosts.

If you want to delete the SSH key for a server with a specific IP address, you can use the IP address instead of the hostname. For example, to delete the SSH key for the server with the IP address "192.168.0.1", you can use the following command:

ssh-keygen -R 192.168.0.1

Keep in mind that this will only delete the SSH key from your local machine. If you want to delete the key from the server as well, you will need to log in to the server and delete the key manually.

Note: You may need to use sudo to run the ssh-keygen command with the -R option, depending on your system configuration.

Created Time:2017-10-30 10:17:49  Author:lautturi