# Use SSH keys with PuTTY on Windows
Source: https://docs.webgee.com/en/development/accessing-a-linux-server-using-ssh-keys-with-putty



Connect from Windows using PuTTY and key authentication. Applies to shared and
reseller hosting with SSH enabled, and to all VPS and dedicated servers.

<Callout type="info">
  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](/en/development/connect-via-ssh). PuTTY is worth it for
  saved sessions and its key agent.
</Callout>

## 1. Generate a key pair [#1-generate-a-key-pair]

1. Open **PuTTYgen** (installed with PuTTY).
2. Set **Type of key to generate** to **EdDSA** with **Ed25519**, or **RSA** at
   **4096** bits if a tool you use cannot handle ed25519.
3. Select **Generate** and move the mouse over the blank area as instructed.
4. Enter a **Key passphrase**. This encrypts the private key on disk, so a copied
   key file is useless without it.
5. Select **Save private key** and save the `.ppk` file somewhere safe.
6. **Copy the public key** from the box at the top of the window.

<Callout type="warn">
  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.
</Callout>

## 2. Authorise it [#2-authorise-it]

**On shared or reseller hosting:**

1. In cPanel, open **SSH Access → Manage SSH Keys**.
2. Select **Import Key**.
3. Leave the private key box empty and paste the **public** key.
4. 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](/en/servers/ssh-keys).

## 3. Connect [#3-connect]

1. Open **PuTTY**.
2. **Session** — enter your hostname or IP, and port `22`.
3. **Connection → SSH → Auth → Credentials** — browse to your `.ppk` file.
4. **Connection → Data** — enter your username in **Auto-login username**.
5. Go back to **Session**, name it, and **Save**.
6. **Open**.

You are prompted for the key passphrase, not your account password.

## Using a key generated elsewhere [#using-a-key-generated-elsewhere]

A key from `ssh-keygen` is in OpenSSH format and PuTTY will not load it directly.
Convert it:

1. Open **PuTTYgen**.
2. **Conversions → Import key**, select your private key.
3. **Save private key** as `.ppk`.

## If it will not connect [#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](/en/security-ssl/how-do-i-unblock-or-whitelist-an-ip-address-from-the-firewall).

## Related [#related]

* [Connect over SSH](/en/development/connect-via-ssh)
* [Add an SSH key](/en/servers/ssh-keys)
