In this blog post, I will show you how to install OpenSSH on a Windows Server 2019 server and connect to it from a Linux machine.
When Microsoft released PowerShell Core and made it working on Linux machine, it allowed moving workloads from Windows to Linux which was great; however, there was no easy way to connect to a Windows machine from Linux.
The reason the above didn’t work was that PowerShell remoting was using WinRM which is built into the Windows OS.
The workaround for that was enabling OpenSSH on Windows and allow any machine with an SSH client to connect.
In this post, I will outline the process to enable OpenSSH on a Domain Joined Windows Server 2019 server and connecting to it from a Linux client.
Enable SSH on Windows Server 2019
The first step in this process is to install the OpenSSH server on my Windows host.
Note: the OpenSSH client is already installed by default on Windows Server 2019.
To check if you have OpenSSH installed to run the following cmdlet
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
To install the OpenSSH server role run:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
To install the OpenSSH client run:
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
After the installation is completed, we need to start the SSH server and configure it to start automatically with Windows.
Set-Service -Name sshd -StartupType 'Automatic'
SSH To Windows Server 2019 from Linux
The final step will be connecting from my Linux machine to my Windows Server using the following command.
Note: I am using an Active Directory account to connect if your machine is not domain joined remove the corp\ part of the command.
Below, you can see that I am now connected to my Window Server.