This section is about creating a new SSH key using ssh-keygen.
Regardless on whether to use SSH key for certificate authority or access authentication usage, you still need to create a key.
. As of year 2020, it's best to use ed25519
algorithm over RSA
for various reasons. Among them are:
The command is as follows:
$ ssh-keygen -o -a 200 -t ed25519 -f ~/.ssh/id_ed25519 -C "john@example.com"
-o
stands for using the OpenSSH format over the conventional PEM format-a
stands for KDF resiliency where the bigger the number, the longer it takes to authenticate your private key's passphrase in exchange of heavier resistance.-t
stands for key scheme. In this case, we want ed25519
.-f
stands for output location where you want to save it in ~/.ssh/id_<name>
.-C
stands for comments. It can be anything.Alternatively, one can stick back to RSA key but as of 2020, you must create a key above 2048-bit versions (recommended 4096-bit).
The command is as follows:
$ ssh-keygen -o -a 200 -t rsa -b 4096 -f ~/.ssh/id_rsa -C "john@example.com"
-o
stands for using the OpenSSH format over the conventional PEM format-a
stands for KDF resiliency where the bigger the number, the longer it takes to authenticate your private key's passphrase in exchange of heavier resistance.-t
stands for key scheme. In this case, we want rsa
.-f
stands for output location where you want to save it in ~/.ssh/id_<name>
.-C
stands for comments. It can be anything.That's all about creating SSH Key.