DEV Community

Clever Lopes
Clever Lopes

Posted on • Edited on

2

Fast guide, creating a ssh key pair for the user in Linux

Pre reqs

For this very short tutorial, you need to have installed the ssh client and server on your linux.
To install on Ubuntu:
$ sudo apt install openssh-client
$ sudo apt install openssh-server

On Arch
$ yay -S openssh or $ sudo pacman -S openssh

Getting Started

To create your key pair run this command:
$ ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "{your_email}"

After this will appear a message to enter a passphrase like this:
Enter passphrase (empty for no passphrase):

You can just press Enter or write your passphrase and confirm.

Return of the commands example

To get your pub key type:
$ cat ~/.ssh/id_ed25519.pub

Get pub key return example

Now you can copy your pub key and register on the ssh client of the service you want, like Github or Amazon.

So you don't have to type the passphrase all the time, your machine needs to have the ssh-agent service. You check if is running with this command:
$ eval "$(ssh-agent -s)"
The command will return the agent pid of the process.

If it is running, you can add your new key to the agent, just type:
$ ssh-add ~/.ssh/id_ed25519.
Then it only will ask for your passphrase once.

Well done! Now you're a cryptographically identifiable citizen in our society.

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay