Enable SSH Windows Server 2019

Introduction

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.

Add SHH Windows Server 2019

 

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

Add SHH Windows Server 2019

 

Verify the OpenSSH server installation

To verify that the OpenSSH server is properly installed type:

Get-Service sshd
Get-Service ssh-agent

 Add SHH Windows Server 2019

 

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:

Start-Service sshd
Start-Service ssh-agent

 Add SHH Windows Server 2019

 

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:

ssh administrator@Win2019srv

(Win2019srv is the name of my Windows Server 2019 box)

Type yes” at the warning message and press “Enter

 Add SHH Windows Server 2019

 

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!

 Add SHH Windows Server 2019

 

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

 Add SHH Windows Server 2019

 

If you now typessh“, you’ll see that the OpenSSH client has been properly installed.

 Add SHH Windows Server 2019

 

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]

 Add SHH Windows Server 2019

 

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!

 

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Leaving already?

We love seeing you around!Leave us your email address and we'll let you know when new content is published.
Holler Box
Holler Box