Find the public key belonging to a private key

Image of Mattias Geniar

Mattias Geniar, October 02, 2018

Follow me on Twitter as @mattiasgeniar

Here’s how you can show the public key part if you have the private key.

$ ssh-keygen -y -f ~/.ssh/id_rsa

This’ll output your public key for SSH in the usual authorized_keys format.

$ ssh-keygen -y -f ~/.ssh/id_rsa
ssh-rsa AAAAB3....Twk5

Just in case you might need it one day!



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.