PuTTY /
Creating SSH keys with PuTTYgen
Attach:puttygen1.mp4 Attach:puttygen2.mp4 Attach:puttygen3.mp4 Attach:puttygen4.mp4 Attach:puttygen-cc.webm Attach:puttygen-cc.mp4 Attach:puttygen-cc.gif Δ
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.
- In the parameters field at the bottom, select the type of key to generate. This guide uses Ed25519.
- Click
Generate
- Optional: In
Key passphrase
, provide a passphrase and write it down securely. Type the passphrase again inConfirm passphrase
. WARNING: If you use a passphrase, the key becomes worthless if you forget the passphrase! - Click
Save public key
. Give it a name likepublickey.pub
. This key can be shared with anyone. - Click
Save private key
. Give it a name likeprivatekey.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
- Connect with PuTTY using a password as described at top.
- Edit
~/.ssh/authorized_keys
:
- Select the public key from PuTTyGen, from the field
Public key for pasting into OpenSSH authorized keys file
. Typectrl+c
to copy.
- Paste the key into
~/.ssh/authorized_keys
by pressingShift+[Ins]
. - Alternatively, you can get the public key from the .ppk you created earlier. Open it with Notepad. It should look like this:
- Select the public key from PuTTyGen, from the field
---- BEGIN SSH2 PUBLIC KEY ---- Comment: "ed25519-key-20210809" AAAAC3NzaC1lZDI1NTE5AAAAINCB6GpCoQPG4byfLwqHyA2SMyTV7RjfVw+bqO3h fTDF ---- END SSH2 PUBLIC KEY ----
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
- Open PuTTY
- Go to
Connection > SSH > Auth
- In
Private key file for authentication
, clickBrowse
,
and load your private key (hint: it ends in .ppk).
- Click
Session
and fill inHostname
as described in the PuTTY connect guide. Then, clickOpen
. - If you used a passphrase for the key, type it in.