So, do you want native SSH in Windows Server? With Windows Server 2019, that is now possible!
SSH can be natively enabled on Windows Server 2019, both the SSH server and client! Although it does seem “illogical” to have SSH installed on a Windows Server machine, the truth is that, nowadays, our work environments are becoming more heterogeneous with each passing day, where Linux machines live side-by-side with Windows Server machines, making the possibility of having SSH on our Windows machines a great and welcoming addition!
Other than Windows Server 2019, it is also possible to enable SSH on Windows 10 starting with Windows 10 April 2018 Update (1803). What are you waiting for?
Besides OpenSSH, Windows Server 2019 brought us a lot other new features, which you can check out here: https://docs.microsoft.com/en-us/windows-server/get-started-19/whats-new-19
Install OpenSSH Server Windows Server 2019
Unfortunately, or no, it looks like we’ll have to get our hands “dirty”! It is not possible to add this feature via Server Manager (correct me if I’m wrong!) and we will have to add it via Powershell!
To get the name of the “package” to install, open a Powershell window as administrator and type:
Get-WindowsCapability -Online -Name Open*
You’ll see that we have available an Open SSH Server and an Open SSH Client.
Let’s start by installing the OpenSSH Server. Type the following in the Powershell window.
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Verify the OpenSSH server installation
To verify that the OpenSSH server is properly installed type:
You will see that both services are in a “Stopped” status. Before starting the OpenSSH services, we need to enable them and set them to start at boot up. For that type:
Set-Service -Name sshd -StartupType Automatic
Set-Service -Name ssh-agent -StartupType Automatic
Now, let’s start both services. Type:
Testing the connection to the SSH server
As stated previously, starting with Windows 10 1803, Windows 10 also comes with its own SSH client, which I already installed in my Windows 10 laptop. From here I am going to try to connect to the SSH server I’ve just installed in my Windows 2019 server.
On a Windows 10 machine, or Linux for that matter, open a command prompt (or terminal) and type:
(Win2019srv is the name of my Windows Server 2019 box)
Type “yes” at the warning message and press “Enter”
Type your password and you’re in! You can run any command you want as if you were sitting in front of your server box!
Now that we’ve confirmed that the OpenSSH server is working properly, let’s install the OpenSSH client!
Install OpenSSH Client Windows Server 2019
Back on the Windows Server 2019 computer, at the powershell prompt type:
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
If you now type “ssh“, you’ll see that the OpenSSH client has been properly installed.
Testing the OpenSSH client
To test the OpenSSH I am going to connect to one of my Linux computers, which is a Raspberry Pi I have lying around :). So, from the server, I’ll type:
ssh pi@[IP address of my Linux box]
And that’s it! We have installed the OpenSSH server and the OpenSSH client on Windows Server 2019!
If you’d like some more reference about installing OpenSSH in Windows Server 2019, please take a look at this Microsoft’s TechCommunity blog post: https://techcommunity.microsoft.com/t5/ITOps-Talk-Blog/Installing-and-Configuring-OpenSSH-on-Windows-Server-2019/ba-p/309540
As always, if you found this article useful, share it with your friends.
If you have any questions or suggestions, leave your comment.
Thank you for reading!