Login to Linux using SSH Keys in PuTTY

This post provides a quick guide to configuring access to a Linux account using SSH keys.
Generate a Private and Public Key Pair
- Download
puttygen.exe
from here. - Click Generate.
- Move the mouse until complete.
- Enter the "Key passphrase".
- Click Save public key.
- Click Save private key.
- Copy the value of the public key in the box on the top (see screenshot) (Do not copy the trailing
rsa-key-20210206
at the end of the string!)

Configure the Linux Server
- Login to the Linux account you want to give access to.
- Run these commands and paste the contents of your public key (from Step 7 above) here:
mkdir ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
vi ~/.ssh/authorized_keys
Configure Session in PuTTY
- Make sure you have the Linux hostname and
.ppk
file to configure a new PuTTY session. - When configuring a new session in PuTTY, navigate to Connection > SSH > Auth and enter the location of your private key
.ppk
file on your local file system.

Logging in to PuTTY
- Upon login, you will be prompted for the Linux username and the private key password.

Exporting PuTTY .ppk Private Key to .pem Format
- In PuTTY Key Generator, select Conversions > Export OpenSSH Key.
- Name the file and add the
.pem
extension. - Choose Save.