Other Tips
Sponsored Link

OpenSSH : Configure SSH Server2025/04/24

 

It's easy to setup OpenSSH Server on Windows 11.

On CUI configuration, set like follows.

[1] Run PowerShell with Admin Privilege and Configure SSH Server.
PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# get available name of OpenSSH
PS C:\Users\serverworld> Get-WindowsCapability -Online | ? Name -like 'OpenSSH*' 

Name  : OpenSSH.Client~~~~0.0.1.0
State : Installed

Name  : OpenSSH.Server~~~~0.0.1.0
State : NotPresent

# install OpenSSH Server
PS C:\Users\serverworld> Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 

Path          :
Online        : True
RestartNeeded : False

# start sshd service
PS C:\Users\serverworld> Start-Service -Name "sshd" 

# set [Automatic] for Startup
PS C:\Users\serverworld> Set-Service -Name "sshd" -StartupType Automatic 

# verify settings
PS C:\Users\serverworld> Get-Service -Name "sshd" | Select-Object * 

Name                : sshd
RequiredServices    : {}
CanPauseAndContinue : False
CanShutdown         : False
CanStop             : True
DisplayName         : OpenSSH SSH Server
DependentServices   : {}
MachineName         : .
ServiceName         : sshd
ServicesDependedOn  : {}
ServiceHandle       : SafeServiceHandle
Status              : Running
ServiceType         : Win32OwnProcess
StartType           : Automatic
Site                :
Container           :

# by default, Windows Firewall is set to allow port [22/TCP], 
# however, the profile is applied only to Private
PS C:\Users\serverworld> Get-NetFirewallRule -Name OpenSSH-Server-In-TCP 

Name                          : OpenSSH-Server-In-TCP
DisplayName                   : OpenSSH SSH Server (sshd)
Description                   : Inbound rule for OpenSSH SSH Server (sshd)
DisplayGroup                  : OpenSSH Server
Group                         : OpenSSH Server
Enabled                       : True
Profile                       : Private
Platform                      : {}
Direction                     : Inbound
Action                        : Allow
EdgeTraversalPolicy           : Block
LooseSourceMapping            : False
LocalOnlyMapping              : False
Owner                         :
PrimaryStatus                 : OK
Status                        : The rule was parsed successfully from the store. (65536)
EnforcementStatus             : NotApplicable
PolicyStoreSource             : PersistentStore
PolicyStoreSourceType         : Local
RemoteDynamicKeywordAddresses : {}
PolicyAppId                   :
PackageFamilyName             :

# to add Public profile, set like follows
PS C:\Users\serverworld> Set-NetFirewallRule -Name OpenSSH-Server-In-TCP -Profile "Private,Public" 
Matched Content