If you already own an SSH private key but somehow lost your public key, you can regenerate the public key using PuTTYGen (PuTTY Key Generator) if you're using Windows.

PuTTYGen supports both ppk (PuTTY Private Key) and OpenSSH private key format thus you can regenerate the public key for both file formats using PuTTYGen.

Steps to generate SSH public key from existing private key using Puttygen:

  1. Download PuTTY Key Generator (puttygen.exe) from the official website and launch the program.
    https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
  2. Click on the Load button on the lower right of the program.
  3. Select your private SSH key from where it is locally stored in your system.

    PuTTYGen by default filters the file type to just display .ppk format. Click on the select list on the lower right and choose All Files to load files of OpenSSH format.

  4. Enter the key's passphrase if requested.
  5. Manually copy the public key displayed on PuTTYGen to a text editor and save it to a file to use it on OpenSSH authorized_key file for passwordless login.
  6. Click on the Save public key button.
  7. Select the location and file name of the public key and click on Save.
Discuss the article:

Comment anonymously. Login not required.

Share!