Install OpenSSH Server on Windows 10/Server
In Windows, remote desktop is the preferred remote access method. But Windows also supports SSH to access command line interface remotely. If you want to use SSH, you must first install OpenSSH Server.
If not already installed, we can install the SSH server on Windows 10 through the app and features by adding the openssh-server package. And it is quite easy.
Setting Up the SSH Server
If your Windows 10 PC doesn't have the SSH server package installed, do the following steps to install it.
From the Start menu open the Windows Settings. Select Apps and then select Apps & Features from the menu to the left.
Go to the Optional features section and click on the Add a feature button.
Select the OpenSSH Server package from the list and click the Install button.
Wait till the installation is finished, then go back to Apps & Features main windows and make sure that SSH server has been installed.
After the installation is completed, the sshd service should be ready to run. Open your Windows Services control manager (Start button > Windows Administrative Tools > Services).
Look for OpenSSH SSH Server, right click on the service and choose Start.
You might also want to set the OpenSSH service startup to Automatic, so it runs whenever you boot your Windows PC. Right click on the SSH service, Select Properties.
Change the Startup type to Automatic.
With the SSH server started and running, your Windows machine should now be listening for connections on port 22. To verify this, use the netstat command to list listening ports.
You can now connect to Windows command line directly using an SSH client. Use your Microsoft account name (or local username if you are using a local account) to authenticate the SSH connection.
Configuring Windows Firewall
Windows automatically configures Firewall to open port 22 to allow communication to the SSH Server. Just make sure the following inbound rule is active.
You can locate The sshd_config_default file, The main configuration file for the SSH server at C:\Windows\System32\OpenSSH directory. In most cases there is no need to edit this file.