Generate new SSH key pairs

SSH keys are utilized for authentication with servers, enabling automation of operations on cloud services and improves security when handled properly.

Generate new SSH key pairs
Green background with terminal box saying ssh-keygen

SSH keys are utilized for authentication with servers, enabling automation of operations on cloud services and improves security when handled properly. They can be generated on operating systems such as Linux, Mac, and Windows.

Note - For Windows you can use Git Bash to simplify the process
  1. Open your terminal and type or paste the following command and replace the email with yours.
$ ssh-keygen -t ed25519 -C "your_email@example.com"

The command will generate a new pair (public, private) of SSH keys using the email you entered as the label.

> Generating public/private ed25519 key pair.

2. In the next prompt, you can press enter to save the SSH key on the default location. You can also type the location and name of the file where you want to save the SSH key in.

> Enter a file in which to save the key (/home/you/.ssh/id_ed25519): [Press enter]

3. In the last prompt, you can enter a secure passphrase to your new SSH private key, adding a layer of security. The consequence if your SSH keys are compromised is that the attacker will have access to all systems that uses those keys. You can add your SSH key to the ssh-agent to not have to re-enter the passphrase each time you need to authenticate. You can press enter twice if you don't want to enter a passphrase.

> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]

References