Regenerating a lost public OpenSSH key

A lost the public SSH key can be just regenerated if you still have the corresponding private SSH key.

Use the OpenSSH command below to print the public key:

$ ssh-keygen -t dsa -y
Enter file in which the key is (/home/username/.ssh/id_dsa):
Enter passphrase:
ssh-dss 
(Your key will be shown here)

If you have lost the private key, you will need to generate a new key pair completely.

Last updated: 13/09/2007