Skip to content

How-ToOS

How to Install and Use OpenSSH on Windows 11

Windows 11 includes OpenSSH as an optional feature. Following Microsoft's documentation, here's how to install the SSH client and server, start the sshd service, check the firewall rule, connect, and set up key-based sign-in.

By , Systems & Technical Editor

4 min read

How to Install and Use OpenSSH on Windows 11

Windows 11 can use SSH without any third-party software. OpenSSH, the open-source version of the Secure Shell tools long used to manage Linux and other systems remotely, is available as an optional Windows feature, so you can connect from your PC to a home server or NAS, or turn a second Windows PC into an SSH server. This guide follows Microsoft's official OpenSSH documentation.

What you get with OpenSSH for Windows

Microsoft says OpenSSH has been available as a feature on demand since Windows 10 build 1809 and Windows Server 2019. On Windows 10 and Windows 11 it isn't installed by default: you install and enable it through optional features. It includes these built-in commands:

  • ssh: the client you run on your own PC

  • sshd: the server component, which must run on the PC you want to manage remotely

  • ssh-keygen: creates and manages authentication keys

  • ssh-agent and ssh-add: store private keys and add them for key-based sign-in

  • sftp and scp: transfer files securely over SSH

Microsoft lists three requirements: at least Windows 10 build 1809 (or Windows Server 2019), PowerShell 5.1 or later, and an account in the built-in Administrators group.

Step 1: Install OpenSSH Client and Server

Using Settings: select Start, type Optional Features and open it (it may be called Manage optional features). Check whether OpenSSH is already installed. If not, choose to add a feature, then search for OpenSSH Client and install it. Only install OpenSSH Server as well if you want other devices to connect to this PC.

Using PowerShell: open PowerShell as an administrator and check what's available:

Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

Then install the parts you need:

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

If you're new to the command line, our guide to using Windows Terminal and our PowerShell 7 vs Windows PowerShell explainer are useful background.

Step 2: Start the SSH server (only if this PC will accept connections)

In an elevated PowerShell window, start the sshd service and, optionally but recommended by Microsoft, set it to start automatically:

Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'

You can do the same in the Services app (services.msc): open OpenSSH SSH Server, set Startup type to Automatic and select Start.

Microsoft notes that installing OpenSSH Server creates and enables a firewall rule named OpenSSH-Server-In-TCP, which allows inbound SSH traffic on port 22. If that rule isn't enabled and the port isn't open, connections are refused or reset. Microsoft's install page includes a PowerShell snippet that checks for the rule and creates it if it's missing. Giving the server PC a fixed address makes it easier to find, so see how to set a static IP address in Windows 11.

Step 3: Connect with ssh

From PowerShell on a PC with the client installed, connect using a username and the server's name or IP address:

ssh username@servername

For a domain account, Microsoft's example uses domain\username@servername. The first time you connect, you'll be asked whether you trust the server's key fingerprint. Typing yes adds it to your list of known SSH hosts. You'll then be asked for the password, which won't be shown as you type. When you connect to a Windows server, you land at a Windows command shell prompt by default.

If you'd rather land in PowerShell, Microsoft explains that you can set the server's default shell with a DefaultShell string value under HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH. Server settings live in %programdata%\ssh\sshd_config.

Step 4: Switch to key-based sign-in

Keys are more convenient than typing a password each time. On your client PC, run ssh-keygen. Microsoft says that if you don't specify an algorithm, Ed25519 is used. Its own example uses ECDSA:

ssh-keygen -t ecdsa

Accept the default location and set a passphrase. Microsoft doesn't recommend an empty one. You'll get a private key (no extension) and a public key (.pub). Treat the private key like a password.

To avoid typing the passphrase every time, enable the ssh-agent service, which is disabled by default, and load your key:

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

Then copy the contents of the public key to the server:

  • Standard user account: into a file called authorized_keys in C:\Users\username.ssh\

  • Administrator account: into C:\ProgramData\ssh\administrators_authorized_keys, which must only be accessible to administrators and the System account

Microsoft's key management page includes PowerShell examples that copy the key and set the correct permissions on the administrators file.

Removing OpenSSH

If you no longer need it, go back to Optional features, select OpenSSH Client or OpenSSH Server and choose to uninstall it, or use Remove-WindowsCapability in an elevated PowerShell window. Microsoft also gives a command to remove the OpenSSH-Server-In-TCP firewall rule.

For graphical remote control rather than a command line, see the best free remote desktop software.

The bottom line

OpenSSH is built into Windows 11 as an optional feature: install OpenSSH Client to connect to other machines, and add OpenSSH Server only on PCs you want to reach remotely. Start the sshd service, check the OpenSSH-Server-In-TCP firewall rule on port 22, connect with ssh username@servername, then switch to key-based sign-in with ssh-keygen, ssh-agent and an authorized_keys file. Keep your private key safe and don't leave the server running if you don't need it.

Sources

  1. 01Microsoft Learn, OpenSSH for Windows overview
  2. 02Microsoft Learn, Get started with OpenSSH Server for Windows
  3. 03Microsoft Learn, Key-based authentication in OpenSSH for Windows
  4. 04Microsoft Learn, OpenSSH Server configuration for Windows

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

How to Install the Wacom Driver on Windows 11 and Keep It Updated

How-To

How to Install the Wacom Driver on Windows 11 and Keep It Updated

How to install the Wacom tablet driver on Windows 11 and keep it updated: find your model number, connect the tablet, download the latest Windows driver from Wacom, register in Wacom Center and install updates, per Wacom's official support pages.

Marcus Thorne2 min

How to Set Up and Connect to a VPN in Windows 11

How-To

How to Set Up and Connect to a VPN in Windows 11

Windows 11 has a built-in VPN client. Following Microsoft's official guidance, here's how to add a VPN profile, choose the right VPN type, connect from the taskbar or Settings, check it's working, and add a VPN with PowerShell.

Marcus Thorne3 min

The Best Free Music Players for Windows in 2026

Best Picks

The Best Free Music Players for Windows in 2026

Want a proper player for your local music library? We pick the best free music players for Windows, MusicBee, foobar2000, AIMP and Dopamine, using each developer's official site, GitHub page and latest release notes.

Hannah Vance4 min

How to Install RTX Remix and Play Remastered Classic Games

How-To

How to Install RTX Remix and Play Remastered Classic Games

NVIDIA RTX Remix remasters classic DirectX 8 and 9 games with path tracing and AI-enhanced assets. Following NVIDIA's official documentation, we cover requirements, which games work, installing the Runtime to play mods and the Toolkit (with its ComfyUI AI tools) to make them.

Marcus Thorne4 min