Applies to: the OpenSSH client built into Windows 10, Windows 11 and Windows Server 2019 to 2025; Linux servers with OpenSSH

Windows includes the OpenSSH client, so you can create SSH keys and log in to a Linux server from PowerShell, without PuTTY. A key is safer than a password: the private key never leaves your computer.

1. Create the key

Open PowerShell (no administrator rights needed):

ssh-keygen -t ed25519 -C "you@laptop"

Press Enter to accept the location C:\Users\you\.ssh\id_ed25519, and set a passphrase. Microsoft’s documentation notes that Ed25519 is used when you don’t choose an algorithm. You get two files:

  • id_ed25519: the private key. Keep it secret, like a password.
  • id_ed25519.pub: the public key, which goes on the server.

2. Copy the public key to the Linux server

Windows has no ssh-copy-id. This one line does the same (you log in with the password one last time):

type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh user@203.0.113.10 "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

We ran the server-side part of this command for a test user: the key was added to ~/.ssh/authorized_keys with permissions 600, and the next login worked with the key.

3. Log in

ssh user@203.0.113.10
ssh -p 2222 user@203.0.113.10                       # if SSH uses another port
ssh -i $env:USERPROFILE\.ssh\other_key user@server  # a key with another name

Remember the passphrase with ssh-agent (optional)

The ssh-agent service is disabled by default. In PowerShell as administrator:

Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent

Then, as your normal user: ssh-add $env:USERPROFILE\.ssh\id_ed25519.

Troubleshooting

  • Permission denied (publickey): check that the public key is in ~/.ssh/authorized_keys of the same user you log in as, and that ~/.ssh is 700 and the file 600.
  • ssh not found: add the optional feature OpenSSH Client in Windows Settings.
  • Using PuTTY instead: connect with PuTTY.

After keys work, you can turn off password logins on the server: set up SSH keys for authentication and root login settings. Transferring files with the same key: SFTP.

Official documentation: Microsoft: key-based authentication in OpenSSH for Windows.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $131.99 a month.

Was this answer helpful?

Still stuck? Open a ticket