Quickly and easily generate a key pair for passwordless connection. Also works perfect as git deploy keys!
Generate the keys
DO NOT DO THIS AS ROOT
Run the command to generate the keys
-bflag sets the bits, 4096 is recommended
-m pemis needed to generate a file in RSA Private Key format, not in OpenSSH Private Key format
-fspecifies the output key pair
my-key-pairwith the name of your key pair (preferably
This will generate two files:
my-key-pair- this is your PEM file, copy paste the contents
my-key-pair.pub- this is the corresponding public key file
Note: You may want to rename the
my-key-pair.pem for convenience.
Set the key to allow login
In order to be able to log in using the generated PEM file, you should add the public key to the authorized_keys list. To do that, run