/ Linux

Generate SSH Key Pair

SSH keys are used to securely authenticate whom or which services are allowed to access your server. This is a short note how to generate this key pair.

Key Pairs consists of a public (~/.ssh/id_rsa.pub) and a private key (~/.ssh/id_rsa) file. The public key file is the one you will share with anyone, or any services, that requires a key authentication. The private key file must always be kept private. If you by accident share the private file, it's highly recommended to generate a new key pair.

In your terminal enter ssh-keygen te generate a unique key. You will be prompted for a password, you can either just hit enter or enter a password.

If you don't enter a password, everyone will have access to where you are granted access if they get your private key file, so it's recommended to use a password.

To get the key use the command cat ~/.ssh/id_rsa.pub copy the output and paste it to your service.