So, Someone Asked You for Your Public Key.


So, Someone Asked You for Your Public Key.
So, someone asked you for your public key, and you’re pretty sure they want your SSH public key, but you don’t really know what to do.

This simple guide will walk you through creating a new OpenSSH RSA keypair that you can use to do things like login to servers using your key instead of a password.

Step 1: Get Specific

First, find out exactly what they want from you.

  1. Ask them: Do you want my SSH public key, or another public key, like PGP? If they say “SSH”, keep reading! You’ll use an SSH key to do things like access a server. (If they say something else like “PGP”, ask them for instructions.)
  2. Ask them: Do you want my SSH public key, or another public key, like PGP? If they say “SSH”, keep reading! (If they say something else, ask them for instructions.)
  3. Ask them: Do you want my public key in OpenSSH format? If they say “yes” (or “I don’t know”) to OpenSSH format, keep reading! (If they say no, ask them for instructions.)

Step 2: Find Your Keypair, or Make a New One

Next, check to see if you already have any SSH keypairs set up.

Open the command line and run ls -la ~/.ssh to list the contents of your .ssh directory.

Do you see listed?

If you do, you already have a key pair! Move on to Step 3.

If you don’t, you need to generate a new key pair.

Run ssh-keygen -t rsa -C "", using your email address instead of

Follow the instructions on-screen. Save your keypair to ~/.ssh/id_rsa. You must set a strong passphrase on your key.

When ssh-keygen is done, move on to Step 3.

Step 3: Learn About Your Keypair

Great! You now have an SSH keypair.

Your public key is the ~/.ssh/ file. This file is safe to share with anyone, it does not need to be protected. The contents of your file will look something like this:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5Jleo8D72veOZ0M722YJTYkIfADhrNLp0BK1cwQWKA/PmuaS+TkluazBprDdpI5vcSQMRH/k+aWVlxBLsLq2e3vbdtyFsFSWJyG0xlwBQPpIpSK9Z92hwWce8wgbzmwBmxRWcdax16OMrn4IEYRMd9WQCrpO3JW5mtKKckyy1JjrljDA7YIqQpyoluvkjm/fosm0jEsBwcaYYg32Yu1aX/eqzxpTVlBsEI29pc3fiIsUajVRYND9FY23uiLSDH4O+UkHFlbAw+Y5WLmZDccIU+p2UsjdDKZEDImbQvQBDKV7LQavFlhPHSb9CDKl4JmZeFUGKHUSb3Q60N6lWBP

Your private key is the file ~/.ssh/id_rsaYour private key is private and should be kept safe, like a password! It just belongs to you! Don’t give it to anyone, and don’t send it over the internet. The contents of your id_rsa file will look something like this:













Step 4: Send Your Public Key

You can now provide your public key to the person who asked you for it. You can:

  • Open your public key — the ~/.ssh/ file — with a text editor. Select the contents, copy to your clipboard, and paste into a message to the person that requested it.
  • Send your public key — the ~/.ssh/ file — to the person that requested it.

Remember: DO NOT send your id_rsa file! Keep it safe, it belongs to you only.

Let’s Work Together. Tell us what you’re looking for. How can we help?

contact us