DEV Community

Maxime Guilbert
Maxime Guilbert

Posted on • Updated on

How to generate a SSH RSA key

To generate a SSH RSA key, you must use a Terminal on Linux or WSL or the git terminal on Windows.

Once you have it ready, you can execute the following command :

ssh-keygen -t rsassh-keygen -t rsa
Enter fullscreen mode Exit fullscreen mode

Directly you will need to answer to some questions.

The first one is to know where you want to store your key? (It includes the file path and the file name)

Enter file in which to save the key (/home/dummy/.ssh/id_rsa):
Enter fullscreen mode Exit fullscreen mode

Next, it will ask you to enter a passphrase to eventually add a layer of security to use this key

Enter passphrase (empty for no passphrase):
Enter fullscreen mode Exit fullscreen mode

then the confirmation of the passphrase

Enter same passphrase again:
Enter fullscreen mode Exit fullscreen mode

For security reasons, it's highly recommanded to set a passphrase! But for multiple reasons you may need to don't set a passphrase. Just ask you if you really need to avoid it, just to be sure.

Then something similar than the following should be printed

Your public key has been saved in /home/dummy/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:IP109CmXCOaMvnu2UXbnoJuiVFmh3u6aN7DLalg4uJQ dummy@dummy
The key's randomart image is:
+---[RSA 3072]----+
|        o o      |
|     . = + + o   |
|    . + = = =    |
|     o = = o     |
|   o .. S + o .  |
|  E o .o.+ o +   |
| . . +o .oo   .  |
|  . ...o=+oo     |
|     .+=**+.     |
+----[SHA256]-----+
Enter fullscreen mode Exit fullscreen mode

Once done, congrats you have your SSH RSA keys! You can find know 2 files:

  • id_rsa.pub (as I named id_rsa my key) the public key
  • id_rsa the private key

Be sure to store your private key in a safe place!


I hope it will help you! 🍺


You want to support me?

Buy Me A Coffee

Top comments (0)