Friday, September 21, 2012

Lose your ssh key pub file?

I somehow lost my ssh key pub file, which is inconvenient when I want to copy it out to other hosts.  I could grab it from another host's authorized_key file, but wouldn't it be easier just to recreate it?  Here's how to do it.

[reamer77@myhost .ssh]$ ssh-keygen -y > id_rsa.pub
Enter file in which the key is (/home/reamer77/.ssh/id_rsa):
Enter passphrase:


Viola.  You should now have your pub file back without having to generate a new private and pub key file.