Enable SSH Server on Windows 11 | Generated by AI

Home 2026.07

Question: How to enable SSH server on Windows 11 so another machine can SSH into it?

Answer:

Windows 11 includes OpenSSH Server as an optional feature. Enable it, start the service, and open the firewall.

1. Install OpenSSH Server

Open PowerShell as Administrator:

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

You should see:

OpenSSH.Client~~~~0.0.1.0   Installed
OpenSSH.Server~~~~0.0.1.0   NotPresent

Install server:

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

2. Start SSH service

Start-Service sshd

Enable auto-start:

Set-Service -Name sshd -StartupType Automatic

Check:

Get-Service sshd

Expected:

Status   Name
------   ----
Running  sshd

3. Allow SSH through Windows Firewall

Usually installation creates this automatically, but verify:

Get-NetFirewallRule -Name *ssh*

If missing:

New-NetFirewallRule `
    -Name sshd `
    -DisplayName "OpenSSH Server" `
    -Enabled True `
    -Direction Inbound `
    -Protocol TCP `
    -Action Allow `
    -LocalPort 22

4. Find Windows machine IP

ipconfig

Example:

IPv4 Address . . . . . . : 192.168.1.100

5. Connect from another machine

From Linux/macOS:

ssh username@192.168.1.100

Example:

ssh lzw@192.168.1.100

First connection:

The authenticity of host ... can't be established.
Are you sure you want to continue connecting?

Type:

yes

Then enter the Windows account password.


On your Linux/macOS client:

ssh-keygen -t ed25519

Copy key:

ssh-copy-id username@192.168.1.100

Windows OpenSSH stores keys here:

C:\Users\<username>\.ssh\authorized_keys

7. Check SSH config

Windows SSH server config:

C:\ProgramData\ssh\sshd_config

Useful settings:

Port 22
PubkeyAuthentication yes
PasswordAuthentication yes

After changing:

Restart-Service sshd

For a Lenovo Xiaoxin Windows 11 machine on your LAN, this is enough. Then you can treat it like a Linux box:

ssh lenovo@192.168.1.x

and run commands remotely.


Generated by AI. Curating and sharing still takes effort. If you find it useful, feel free to donate. WeChat: @lzwjavaWeChat QR · X: @lzwjava · Say hi 👋

Back Donate