Linux: Generate keys for public-key authentication

Public key authentication is a cornerstone of internet security. Having a public:private key pair is the prerequisite for using public key authentication.

In Linux, you can generate a good keypair simply by typing: ssh-keygen

However, it is probably a good idea to do one of the following:

  • use a large number of bits with the rsa algorithm by typing: ssh-keygen -t rsa -b 4096
  • use the newest algorithm by typing: ssh-keygen -t ed25519
12 / 2019