In this tutorial, I will show you how to install SSH server (OpenSSH) on Windows Server 2019/2022.
As of Windows Server 2019, the OpenSSH server is a native additional feature.
For previous versions of Windows Server a tutorial is available here: OpenSSH client and server – installation on Windows Server 2012R2 and 2016
From the start menu, click on Settings.
In the list of WIndows settings, open Applications.
Open optional features
Click on optional features.
Open Add additional functionality
Click on Add a feature.
Find the SSH server
In the search box enter SSH to filter the features.
Select OpenSSH Server
Select the OpenSSH Server feature and click Install.
Wait during the installation
Wait while the OpenSSH server is installed on Windows Server, the installation requires the server to be connected to the Internet.
Once the installation is complete, close the settings
Once the OpenSSH server is installed, close Windows settings.
Open the services.msc console and find the OpenSSH Server service
Open the MMC services.msc console and look in the list for the OpenSSH Server service, we can see that it is not started and in Manual starting. Click on Start.
Change the startup mode
If necessary, open the properties of the service and change the start type to Automatic so that it is always started.
Connect to Windows server with SSH
If the firewall is enabled, ensure that port 22 allows incoming connections. From another computer from an SSH client, connect:
During the first connection, you must accept the certificate.
In the tutorial, I am using servers that are members of the same domain, so the connection is established with my account on the server where I use the client.
It is possible to use another user
Once connected, use the ms-dos and PowerShell commands to manage the server.
You now know how to install and use an OpenSSH server on Windows Server.
I find this alternative to WinRM interesting in particular for connecting to Workgroup servers, because WinRM requires a particular configuration.
If you want to change the configuration of the SSH server, the sshd_config configuration file is located in the following location: C: \ ProgramData \ ssh