Use SSH keys with PuTTY on Windows
Generate a key with PuTTYgen, authorise it on your account, and connect — including the format conversion that catches people out.
Connect from Windows using PuTTY and key authentication. Applies to shared and reseller hosting with SSH enabled, and to all VPS and dedicated servers.
Windows 10 and 11 include OpenSSH, so you can use ssh directly in PowerShell
or Windows Terminal without PuTTY at all — see
Connect over SSH. PuTTY is worth it for
saved sessions and its key agent.
1. Generate a key pair
- Open PuTTYgen (installed with PuTTY).
- Set Type of key to generate to EdDSA with Ed25519, or RSA at 4096 bits if a tool you use cannot handle ed25519.
- Select Generate and move the mouse over the blank area as instructed.
- Enter a Key passphrase. This encrypts the private key on disk, so a copied key file is useless without it.
- Select Save private key and save the
.ppkfile somewhere safe. - Copy the public key from the box at the top of the window.
Copy the public key from the box in PuTTYgen, not from the saved file.
PuTTY's saved public key format has header lines and is not what
authorized_keys expects — pasting it produces a key that is accepted by the
interface but never works.
2. Authorise it
On shared or reseller hosting:
- In cPanel, open SSH Access → Manage SSH Keys.
- Select Import Key.
- Leave the private key box empty and paste the public key.
- Import, then select Manage beside it and choose Authorize.
Importing alone does nothing — the key is not usable until authorised.
On a VPS: add it in the Cloud Console instead — see Add an SSH key.
3. Connect
- Open PuTTY.
- Session — enter your hostname or IP, and port
22. - Connection → SSH → Auth → Credentials — browse to your
.ppkfile. - Connection → Data — enter your username in Auto-login username.
- Go back to Session, name it, and Save.
- Open.
You are prompted for the key passphrase, not your account password.
Using a key generated elsewhere
A key from ssh-keygen is in OpenSSH format and PuTTY will not load it directly.
Convert it:
- Open PuTTYgen.
- Conversions → Import key, select your private key.
- Save private key as
.ppk.
If it will not connect
- "Server refused our key" — imported but not authorised, or the public key was pasted from the saved file rather than PuTTYgen's box.
- Asks for a password instead — PuTTY is not finding the key. Check the path under Auth → Credentials.
- "Connection refused" — SSH is not enabled on the account.
- "Network error: Connection timed out" — your IP may be firewall-blocked, see Unblock an IP address.
Related
Enable error logging in PHP
Turn on error reporting to diagnose a blank page — to a log file, never to the browser on a live site.
Enter a Python or Node.js virtual environment
Applications created with the Selectors run in their own environment. Enter it before running npm, pip or gem, or you use the wrong interpreter.