Photo by Jaye Haych on Unsplash

Very generally, a private key is a way to hide something. In computer security, we can sometimes think of the lock as the public key. The public and private keys must work together to be allowed access. SSH is an acronym for secure shell which is basically a security protocol to give us secure terminal access (access to the computer or server) over the web.

We are going to create a public and private SSH key pair on this page. This SSH key should not be shared.

Here are a couple ways you can use your SSH public key:

  • Add the key to Github/Gitlab to allow you to commit to a repository
  • Add the key to a server to be able to SSH log in with your key
  • Add the key to your Digitalocean account so whenever you create a server your public SSH key is added automatically

Platform specific notes

Windows: To follow along, you should use WSL (Windows Subsystem for Linux) to get the same experience here.

Mac: Already has ssh-keygen command available.

Linux: If you don’t have ssh-keygen install it with your OS’s package manager.

  1. Open a terminal

    empty terminal

  2. Create an ssh key with the following command ssh-keygen -t ed25519 -C "80pxtutorials@protonmail.com"

    • Replace 80pxtutorials@protonmail.com with your email. Here we are storing our email as a comment, or note for this SSH key so we can remember where it came from later.
    • Note: there are many different algorithms you can use to create your SSH key. 80px is taking a page out of Gitlab’s book and is using ed25519 for our mechanism to generate the key.
  3. We are going to be asked where we want to store the keys

    where to save ssh keys

    • You can hit enter to store the key in the default folder. That is a folder named .ssh inside your home directory.
  4. You will be asked to enter a passphrase, and to enter it again for verification. This will be used whenever you have to verify your key.

    ssh passphrase

  5. You’re done!


    • You have successfully made an SSH key. What does this mean in terms of the computer? You have now made a public and private key inside of the /home/your_computer_user/.ssh/ directory.
    • If we look at the directory we can see the id_ed25519 private key file, and the id_ed25519.pub public key file.

    ssh directory