logo

Building an SSH Server on Windows 📂Programing

Building an SSH Server on Windows

Overview

Windows now provides many Linux-specific convenience features including PowerShell with the release of version 10. The ssh server, for instance, can be very easily installed through the GUI.

Guide

Step 1. Apps and Features

20191213\_163734.png

Press Win+S to search for Add or remove programs or Apps and features, then click on Optional features.


Step 2. Install OpenSSH Server

20191213\_163935.png

20191213\_163950.png

Click on Add a feature and install OpenSSH Server.


Step 3. PowerShell

20191213\_170225.png

Run PowerShell as administrator.

20191213\_170340.png

  • Executing Start-Service sshd will start the server,
  • Executing Stop-Service sshd will stop the server,
  • You can check the current status of the server with Get-Service sshd.

Autostart

The server shuts down when the computer is turned off, but you can set it to open automatically upon boot with the following command:

Set-Service -Name sshd -StartupType 'Automatic'

Port Change

After executing the terminal in administrator mode, enter the following command:

Invoke-Item C:\ProgramData\ssh\sshd_config

By opening C:\ProgramData\ssh\sshd_config with Notepad and changing # Port 22 to Port 1234 then saving, the port will change from the default 22 to 1234. Restart ssh for the port change to take effect1.