Generating SSH keys

Written by Robert -

Here we are going to generate 4096 bit keys to use with SSH.

To generate SSH keys on your desktop, use the following command:

I assume that you have ssh-keygen installed. If that's not the case, consult the manual of your distribution.

ssh-keygen -t rsa -b 4096


This is the location for your private key. The default should work for most users.


Enter a difficult password, something that you don't use for anything else.


Repeat the password.


Here you can see that it successfully created both the public (~/.ssh/ and the private (~/.ssh/id_rsa) keys. The randomart is not something you usually need.

Always keep your private key private.