Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Security

Create SSH keys on Windows 11 and use them on any server

Create an Ed25519 SSH key on Windows 11 with the built-in OpenSSH client, guard it with a passphrase and ssh-agent, and add it to Linux and Windows servers.

CloudSat teamNovember 18, 20266 min read
Abstract illustration of a key split into a glowing public half and a shielded private half above a laptop outline
On this pageCheck the OpenSSH client

Windows 11 includes the same OpenSSH tools that Linux and macOS use, so creating an SSH key needs no extra download. A key pair replaces the server password with something that cannot be guessed: a private key that stays on your PC and a public key that you copy to each server. This guide creates the key, protects it, installs it on Linux and Windows servers, and shows how to reuse it in PuTTY.

Check the OpenSSH client

Open PowerShell or Windows Terminal and run:

ssh -V
Get-ChildItem $env:USERPROFILE\.ssh -ErrorAction SilentlyContinue

The first command prints the client version. If Windows says ssh is not recognized, add it under Settings > System > Optional features > View features, search for OpenSSH Client, or install it from PowerShell run as administrator:

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

The second command lists keys you may already have. Files named id_ed25519 or id_rsa are existing private keys; do not overwrite one that servers already trust.

Generate an Ed25519 key

ssh-keygen -t ed25519 -C "laptop-2026"

Press Enter to accept the default location, C:\Users\you\.ssh\id_ed25519, then type a passphrase. The comment after -C is a label that helps you recognize the key later in a server's key list; a device name works better than an email address.

You get two files:

File What it is Where it goes
id_ed25519 Private key Stays on this PC. Never copy it to a server or a chat
id_ed25519.pub Public key Into authorized_keys on every server you log in to

Ed25519 is the right default: short keys, fast signatures and support in every OpenSSH release of the last decade. Use RSA with 3072 or 4096 bits only for an old device that accepts nothing else. DSA keys are gone: OpenSSH 10.0 removed support for them.

Protect the private key

A passphrase encrypts the private key file, so a copied file is useless without it. To avoid typing it at every connection, let the OpenSSH agent hold the decrypted key. The agent service is disabled by default on Windows. Enable it once from PowerShell run as administrator, then add the key from your normal session:

Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent
ssh-add $env:USERPROFILE\.ssh\id_ed25519
ssh-add -l

The agent keeps keys tied to your Windows account and loads them again after a restart, so you type the passphrase once per key, not once per day.

OpenSSH also refuses private keys that other accounts can read. If you copied a key from another machine and see a warning about bad permissions or an unprotected private key file, give your account sole access:

icacls $env:USERPROFILE\.ssh\id_ed25519 /inheritance:r /grant:r "$($env:USERNAME):F"

Install the public key on a Linux server

Windows has no ssh-copy-id, but one pipeline does the same job. It logs in with the account password one last time and appends the key:

Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | ssh admin@203.0.113.10 "umask 077; mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

umask 077 makes sure the folder and file are created readable only by that user, which sshd insists on. Now connect again with ssh admin@203.0.113.10: you should be asked for the key's passphrase, or nothing at all if the agent holds it, instead of the account password. Once that works for every account you use, switch password logins off on the server, as shown in change the SSH port without locking yourself out.

For new servers, skip the copying entirely. On CloudSat you can store the public key in your account and select it in the deploy wizard, so the server boots with it installed (Add and use SSH keys).

Install it on a Windows server

Windows Server can run OpenSSH Server too, with one twist. For a member of the local Administrators group, sshd ignores the key file in the user's profile and reads C:\ProgramData\ssh\administrators_authorized_keys instead. That file must be readable only by Administrators and SYSTEM. On the server, after pasting your public key into it:

icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"

Standard users keep their keys in C:\Users\name\.ssh\authorized_keys. Microsoft notes that key authentication works with local and Active Directory accounts but not with Microsoft Entra ID accounts.

Use the same key in PuTTY or WinSCP

PuTTY stores keys in its own .ppk format. Open PuTTYgen, choose Conversions > Import key, select id_ed25519, enter the passphrase, and click Save private key. In PuTTY, load the result under Connection > SSH > Auth > Credentials. WinSCP accepts the same .ppk file, and can import OpenSSH keys itself.

PuTTY has its own agent, Pageant, which is separate from the Windows OpenSSH agent. If you use both toolsets, either load the key into both or settle on one.

Save typing with a config file

Create C:\Users\you\.ssh\config with a short block per server:

Host web-01
    HostName 203.0.113.10
    User admin
    IdentityFile ~/.ssh/id_ed25519
    IdentitiesOnly yes

After that, ssh web-01, scp file.txt web-01:/tmp/ and editors such as VS Code all use the right user and key. IdentitiesOnly yes stops the client from offering every key in the agent, which can trip a server's limit on failed attempts. More options are covered in SSH client setup for daily server work.

When the server still asks for a password

Run the client in verbose mode and read what it offers:

ssh -v admin@203.0.113.10

Look for Offering public key followed by Server accepts key. If the key is offered and refused, the cause is on the server:

  • Wrong account. The key was added to root but you log in as admin, or the other way around.
  • Permissions. On Linux, ~/.ssh must be 700, authorized_keys 600, and the home folder not writable by others. sshd silently ignores keys when these are too open.
  • Broken line. The public key must sit on a single line. Pasting it through an editor that wraps long lines splits it in two.
  • Windows administrators. The key was put in the user profile instead of administrators_authorized_keys.

If no key is offered at all, ssh-add -l probably answers that the agent has no identities: add the key again.

FAQ

Should I use Ed25519 or RSA?

Ed25519, unless a device accepts only RSA. In that case use at least 3072 bits. Both are far stronger than any password a person can remember.

Can one key serve every server?

It can, but one key per device is easier to manage. If a laptop is lost, you remove its single public key from your servers and every other device keeps working.

What if I lose the private key?

There is no way to recover it. Create a new pair, then replace the old public key on every server. Keep a way into each server that does not depend on the key, such as the provider's web console.

Why does Git ignore the key in my agent?

Git for Windows ships its own ssh.exe, which does not talk to the Windows agent. Point Git at the system client with git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe".

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.