Watch all our Tutorials and Training Videos for Free on our Youtube Channel, Get Online Web Tools for Free on swebtools.com

Search Suggest

Recover SSH Public Key from Private Key Easily

recover ssh public key from ssh private key, ssh get public key from private key, regenerate new ssh public key, how to retrieve lost ssh key

This post will show you How to Recover SSH Public Key from Private Key Easily with step by step procedure.. 

If you are interested in learning, Request you to go through the below recommended tutorial.

DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online

Recover SSH Public Key from Private Key Easily

How to Recover SSH Public Key from Private Key

To recover the SSH public key from a private key, you can use the ssh-keygen command in terminal.

1. Open a terminal window and navigate to the directory where your private key is located.

2. Type the following command and press Enter:


ssh-keygen -y -f [private key file name]


3. The command will output the corresponding public key in the format "ssh-rsa [public key] [username]". This is the public key that corresponds to the private key you provided.

4. You can also use the ssh-keygen command to convert the private key to a different format, such as OpenSSH or PuTTY, by using the -m option. For example, to convert a private key to the OpenSSH format, you can use the following command:


ssh-keygen -y -f [private key file name] -m pem


5. In this case, the command will output the public key in the OpenSSH format, which can be used with other SSH clients that support this format.

Note: If the private key is password protected, you will be prompted to enter the password before the command can generate the public key.

That’s it for this post, Hope this post helped you to understand How to Recover SSH Public Key from SSH Private Key Easily.

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.