To remove an SSH key from your virtual machine, follow these steps:

  • Navigate to default directory where SSH keys are stored using this command:

cd /home/user/.ssh

  • Delete the file using the following command:

 rm -rf file name

For remote server edit $HOME/.ssh/authorized_keys or $HOME/.ssh/authorized_keys2 file and remove your public key. This will delete login from home computer into your server. Finally, you can always delete user from your system using the pw (FreeBSD) or userdel (Linux / UNIX) command.

Did this answer your question?