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.