If you are from the world of Linux and because of one reason or another you currently find yourself in a situation where Windows 2019 servers are all over around you, there is good news for you. We know you are used to using SSH to log in and administer your servers and here you are in a different environment altogether. While there are Powershell options for logging into remote Windows Servers, most admins from a Linux background can find it hard to adapt.
Windows Server 2019 and the most recent version of Windows 10 come with the capability of installing SSH client and an SSH server. Now it is possible to just use your favorite ssh client instead of RDP or Windows Subsystem for Linux. This is very good news.
Let us not waste more time and proceed to install OpenSSH Server. Make sure your Windows Server has internet access for the OpenSSH Server part.
Step 1: Open Settings
Click on “Start” button and select Settings. It should be the gear icon.
Step 2: Apps
After settings is fired up, select “Apps” then click on “Manage optional features“
Step 3: Choose OpenSSH Server
You should see “OpenSSH Server” under “Add a feature“. Click on it and then click on “Install“
Step 4: Start the Server and change start-up to Automatic
Open “Services” applications by clicking on the “Windows” button and search for “Services“. Once it is open look for OpenSSH Server, right-click and select properties. A new pop-up window will open. In it, change the start-up to Automatic from the drop-down as shown in the illustrations below and then start the server.
Right-click OpenSSH Server and select properties
Change the start-up to Automatic, “Start” the Server and click “OK“
Step 5: Allow port 22 in firewall
If your firewall is on in your server, allow TCP Port 22 so that clients can be able to connect to the server. Follow How To open a port in Windows Server Firewall guide for that only changing the port to 22.
Step 6: Install SSH Client on Windows
Install using PowerShell
You can otherwise install the OpenSSH Server and client by running the following commands in Powershell. Open your Powershell with Administrator privileges and run the commands.
Commands to run in PowerShell
## Install OpenSSH.Server Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 ## Install OpenSSH.Client Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 ## Change server start-up to Automatic Set-Service -Name sshd -StartupType ‘Automatic’ ## Start the Server and change start-up to Automatic Start-Service sshd
Step 8: Testing OpenSSH Server
Use the SSH Client to connect to SSH Server as shown below. AS you can see, we are on a server with IP 10.10.20.2 and we are “sshing” to 10.10.20.21. Input “yes” and key in the password of the account.
And we are in..
We have successfully managed to install and Configure OpenSSH Server and Client. Thank you for reading through.