Creating SSH keys with PuTTYgen

Attach:puttygen.mp4 Δ

Generate Public/Private Key

For additional security, you can use a public/private key pair to login. If you disable password authentication?, your sshd setup will be more secure.

  1. In the parameters field at the bottom, select the type of key to generate. This guide uses Ed25519.
  2. Click Generate
  3. Optional: In Key passphrase, provide a passphrase and write it down securely. Type the passphrase again in Confirm passphrase. WARNING: If you use a passphrase, the key becomes worthless if you forget the passphrase!
  4. Click Save public key. Give it a name like This key can be shared with anyone.
  5. Click Save private key. Give it a name like privatekey.ppk. Keep the private key safe; never share this key!

Optional: To export this key for another ssh client, click on Conversions in the menu at top, then click Export OpenSSH key. Give it a name like private.key.

You have now generated your public and private key!

Adding the Public Key

  1. Connect with PuTTY using a password as described at top.
  2. Edit ~/.ssh/authorized_keys:
    1. Select the public key from PuTTyGen, from the field Public key for pasting into OpenSSH authorized keys file. Type ctrl+c to copy.
    2. Paste the key into ~/.ssh/authorized_keys by pressing Shift+[Ins].
    3. Alternatively, you can get the public key from the .ppk you created earlier. Open it with Notepad. It should look like this:
Comment: "ed25519-key-20210809"

Ignore the comment lines, copying only the key; join the lines together, and add ssh-ed25519 in front:

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINCB6GpCoQPG4byfLwqHyA2SMyTV7RjfVw+bqO3hfTDF

Logging in with Private Key

  1. Open PuTTY
  2. Go to Connection > SSH > Auth
  3. In Private key file for authentication, click Browse,

and load your private key (hint: it ends in .ppk).

  1. Click Session and fill in Hostname as described in the PuTTY connect guide. Then, click Open.
  2. If you used a passphrase for the key, type it in.