How To Activate OpenSSH on Windows Server 2022

In this guide, we intend to teach you How To Activate OpenSSH on Windows Server 2022.

OpenSSH is a powerful collection of tools for the remote control of, and transfer of data between, networked computers. OpenSSH is a freely available version of the Secure Shell (SSH) protocol family of tools for remotely controlling, or transferring files between, computers.

It provides a server daemon and client tools to facilitate secure, encrypted remote control and file transfer operations, effectively replacing the legacy tools.

Activate OpenSSH on Windows Server 2022

In this tutorial, you will learn to install OpenSSH on your Windows Server in two ways.

  1. Through Windows Settings
  2. Using Windows PowerShell

Now follow the steps below to complete this guide.

Install OpenSSH From Windows Settings

First, from the start menu open the settings window.

Then click on the Apps.

Windows server settings

In the Apps window, you will see all the applications installed on Windows. Now to install a new App click on the Optional features.

Optional features on Windows server 2022

At the opened window click on the Add a feature to see all the available features that can be installed on your system.

Note: Loading the list may take some time, it depends on your internet speed.

Add a new feature

At this point, search for the OpenSSH Server on Windows server 2022 and click on it and install it.

Activate OpenSSH server

Then wait until OpenSSH is completely installed on your system.

Once installed, both OpenSSH Client and Server will be available on the list of Installed Features.

Install OpenSSH From Windows PowerShell

If you want to install OpenSSH by using the command line, follow the steps below.

First, open PowerShell as an Administrator.

Open PowerShell on Windows server 2022
PowerShell

Then, use the following commands to install the OpenSSH Client and Server on your system:

Add-WindowsCapability -Online -Name OpenSSH.Server
Add-WindowsCapability -Online -Name OpenSSH.Client

In your output you will see:

Output
Path :
Online : True
RestartNeeded : False

Note:

To configure OpenSSH, use the following command to open the main configuration file in Notepad and make your preferred changes.

 start-process notepad C:\Programdata\ssh\sshd_config

Configure Firewall For OpenSSH on Windows Server 2022

At this point, you must allow the OpenSSH port through your Windows firewall. To do this, follow the steps below.

First, open the Windows start menu, locate and click Server Manager.

Server manager

In the Server Manager window, navigate to Tools, and select Windows Defender Firewall with Advanced Security from the drop-down list.

Windows defender firewall

Now, click Inbound Rules. Then, select New Rule from the right pane.

Define a new rule

In the New Inbound Rule Wizard, select Port from the list of options, then click Next.

Select the type of firewall rule

Select ‘TCP’, then enter port 22 in the Specific local ports: section.

Define protocol and ports

Next, allow the connection and click Next.

Allow the connection

Next, assign the rule to server profiles and click Next.

Specify Rule applies

Then, set a custom name for easy identification from the list of Firewall rules. Finally, click Finish to save the new firewall rule.

Set a name rule for OpenSSH on Windows server 2022

Log in to Windows Server 2022 via SSH

At this point, you can start to login into your Windows server 2022 via SSH.

First, from your PowerShell terminal run the following command to start the OpenSSH server:

Start-Service sshd

Then, Log out of the RDP session.

Then, initiate an SSH connection from your local computer to the server using the following command:

$ ssh -l Administrator SERVER-IP

Replace Administrator with your target username and SERVER-IP with your actual Windows server address.

Output
.
Are you sure you want to continue connecting (yes/no/[fingerprint])? 

Verify the server key by accepting it with yes. Then, enter the user account password to connect to the remote Windows server over SSH.

Once logged in, your SSH terminal should be similar to the one below:

Microsoft Windows [Version 10.0.20348.405]
(c) Microsoft Corporation. All rights reserved.

Administrator@EXAMPLE C:\Users\Administrator>

Conclusion

At this point, you learn to Activate OpenSSH on Windows Server 2022.

Hope you enjoy it.

You may be interested in these articles:

Enable Defender Antivirus on Windows Server 2022

How To Install MonoDevelop on Windows Server 2019

Install Android Studio on Windows Server 2019

Newsletter Updates

Enter your email address below and subscribe to our newsletter

One comment

Leave a Reply

Stay informed and not overwhelmed, subscribe now!