Key-based login with PuTTYgen and Pageant

Passwords are guessable and get typed into the wrong window. A key pair fixes both problems, and on Windows the whole setup takes about ten minutes with two utilities that came with your PuTTY install.

Generate the pair

  1. Open PuTTYgen and choose Ed25519, or RSA at 3072 bits if the server is older.
  2. Click Generate and move the mouse to seed randomness.
  3. Enter a passphrase — this is what protects the file if the laptop is stolen.
  4. Save the private key as a .ppk file in a folder outside any cloud-synced directory.
  5. Copy the public key text shown in the top box; you need it verbatim.

Install the public key on the server

Append the copied line to ~/.ssh/authorized_keys on the remote account, as one unbroken line. Permissions matter: the .ssh directory should be 700 and the file 600, or the server will silently ignore it.

chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys

Point PuTTY at the private key

In your saved session, open Connection, SSH, Auth, Credentials and browse to the .ppk file. Save the session again. The next login asks for the key passphrase instead of the account password.

Add Pageant so you type it once

  • Start Pageant, add your key, and enter the passphrase.
  • PuTTY, PSFTP and Plink all pull the key from Pageant automatically.
  • Put a shortcut to pageant.exe with your key path in the Startup folder to load it at logon.
  • Right-click the tray icon and remove keys before handing the laptop to anyone.

Questions people ask about this

The server still asks for my password. Why?
Usually file permissions on the server, a public key that was pasted with line breaks, or a session that is not loading the .ppk file. Check them in that order.
Can I reuse one key everywhere?
You can, but a per-environment key limits the blast radius if one is exposed and lets you revoke access to a single system.

Independent guide. Software names belong to their respective developers; always download from the vendor's own site. Back to all Windows SSH guides.