SSH into Windows
Windows 10

SSH Into Windows And How To Set SSH Into Windows 10?

SSH, also known as Secure Shell, is a remote control protocol that allows users to control and edit servers remotely over the Internet. This application has been used simply in Linux and Mac. Microsoft is not an exception; this boss of technology also developed SSH into Windows. You may wonder, “How to set SSH into Windows 10?” which will be answered below.

Microsoft has officially integrated the OpenSSH application into Windows 10. Presently the server is connected via SSH protocol from Windows 10 by installing Putty software or other third-party SSH software. The SSH client is a part of Windows 10, but this application is an optional feature that isn’t installed as default. 

How To Install And Enable SSH Into Windows 10?

First of all, your Windows 10 must be up-to-date or from the 1809 version. A question appears here: How to check the Windows 10 version? It is simple; you need only to run the code: winver.

 SSH into Windows

If your Windows 10 is installed with a suitable version, we will start to configure SSH. In case your version of Windows 10 is older, you want to first update it. 

There are two ways to update your Windows. The first method is Windows Update. An ISO picture applied with an up-to-date Windows 10 version is another effective way to solve this case. This image can be created by the Windows Media Creation Tool. 

Besides, using GitHub to set the port of Win32-OpenSSH is also a solution for people who do not want to update Windows 10. Next, we will continue to start the OpenSSH server for Windows 10. 

Step 1: Open the Graphical Setting Panel.

Step 2: Select Setting > Apps > click on Optional features.

 SSH into Windows

Step 3: Go to Add a feature, find and choose OpenSSH Server (Secure shell (SSH) server using OpenSSH to manage secure key and remote accession from other devices), then click Install.

 SSH into Windows

Other ways to SSH into Windows 10

Alternative 1: Powershell

Powershell is another way to set the server by following the command: Add-WindowsCapability -Online -Name OpenSSH.Server*

We can see in this image how it’s carried out:

 SSH into Windows

Alternative 2: DISM

In additions to Powershell, we can use DISM to install OpenSSH with the command: dism /Online /Add-Capability/CapabilityName:OpenSSH.Server~~~~0.0.1.0

Check Whether SSH Is Set Up

At this point, to know if we install the SSH Windows 10 successfully, the below PS command is used:
Get-WindowsCapability -Online | ? Name -like ‘OpenSSH.Server*’

Name : OpenSSH.Server~~~~0.0.1.0

State : Installed

 SSH into Windows

The PowerShell command we use to examine the condition of SSHD services and SSH-agent is Get-Service: Get-Service -Name *SSH*.

We can see how it is performed in the following image.

Activate SSH Service

However, you can find that both above services do not go to the list of an automatic startup. They are in a Stopped state. 

Thus, we need the next commands to begin services and set an automatic start list:

Start-Service SSHD

Set-Service -Name SSHD -StartupType ‘Automatic’

Start-Service ‘SSH-agent’

Set-Service -Name ‘SSH-agent’ -StartupType ‘Automatic’

 SSH into Windows

Enable The TCP Port 22 Linkage

After inserting the above command, we use the next one to connect to the standard port of SSH – TCP gate 22 in the system of Windows Firewall: netsh advfirewall firewall add rule name=”SSHD service” dir=in action=allow protocol=TCP localport=22.

Connect From Operating System: Linux

With the above steps, now your Windows 10 is connected to another SSH client. 

For example, if you want to connect your computer with a different user with Linux, you will insert the code: SSH -p 22 [email protected]

In the above command, admin is changed by the client’s username that will be connected; 192.168.1.90 is the IP information of your computer with Windows 10.

 SSH into Windows

Next, there is a new window with a command prompt of Windows in the SSH section.

Connect From PowerShell On Windows 10

In Windows 10, if you want to change the command prompt into the Powershell console when you log in with SSH, the following code is used by the admin: 

New-ItemProperty -Path “HKLM:\SOFTWARE\OpenSSH” -Name DefaultShell -Value “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” -PropertyType String –Force

With this command, the default shell of OpenSSH is changed, and the PowerShell prompt will appear when you connect to Windows through SSH.

 SSH into Windows

How To Change Password Authentication Into SSH Authentication With A Key?

It is easy; you only need to follow these steps:

Step 1: Create a key by SSH-keygen from the client user.

Step 2: Copy the content of the id_rsa.pub file into C:usersadmin.SSHauthorized_keys file in the host computer with Windows 10.

Step 3: Insert the code: SSH -l [email protected]

Now, you don’t need a password, but your Windows 10 was connected to a Linux client.

Enable More Server Settings On OpenSSH

Moreover, you can use the configuration file of programdata\SSH\SSHD_config to start many different settings with the OpenSSH server in Windows.

 SSH into Windows

You can look at the below example: To remove authentication by password and remain key-based authentication, you add the command:
PubkeyAuthentication yes

PasswordAuthentication no

Conclusion

From the detailed instructions in this article, we hope you have a rough overview of SSH into Windows and how to set SSH Windows 10 in connecting to another Windows 10 client computer.

Please do not hesitate to reach out if you have any questions about how to SSH into Windows 10.

Leave a Reply

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

Back To Top