Linux Stuff && Coffee

How to Generate / Extract a Public Key From a Private Key

| Comments

If you have lost your SSH Public key but still have your Private Key you can extract the private key with the following command:

lionor$ ssh-keygen -y
Enter file in which the key is (/Users/dave/.ssh/id_rsa):
Enter passphrase:

Your ssh public key will now be displayed.

the above was entered on a Mac, the same applies for Linux obviously your home drive location would be /home – I would recommend this option over opening the file and copying and pasting it out, I would then echo the input into a key file and copy it to the remote server.