How to remove SSH Key on Mac OS X / macOS

How to remove SSH Key on Mac OS X / macOS

Here is an easy way to remove ssh key on Mac OS X (maxOS) by command line.

If you reinstalled your Linux system, and try to ssh it. You may get an error message from your Mac devices.

'' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'' @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
'' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Then you may think how to remove the ssh key and reconnect to your Linux server. The solution is really easy, just type a short command in your Mac terminal.

  • ssh-keygen -R IP_address
  • ssh-keygen -R hostname .domain.com

Here is the sample command:

ssh-keygen -R 192.168.1.1
ssh-keygen -R host.linux.com

Then, the SSH key should be removed and you can reconnect to your Linux server now.

Like this post? Please share this:

Leave a Reply

Your email address will not be published.