Back in 2017 Microsoft made OpenSSH available on Windows 10. Shorty after OpenSSH was also available for Windows Server, version 1709. This blog post should give you a simple step by step guy how you install OpenSSH Server on Windows Server. OpenSSH is available for Windows Server, version 1709 and higher. If you are running Windows Server 2016, and you want to stay in the long-term servicing branch, you will need to wait for the next Windows Server LTSC build.
Install OpenSSH Server on Windows Server
If you are running a Windows Server 1709 or higher, you can simply use PowerShell to install the OpenSSH Client and Server.
You can use the following PowerShell commands to install the OpenSSH Server on the server.
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Install the OpenSSHUtils helper module, which is needed to fix the ACL for ths host keys.
Install-Module -Force OpenSSHUtils
After the installation you can find the OpenSSH Server files and some more configuration options under “C:\Windows\System32\OpenSSH”
Next you need to configure the OpenSSH Server (sshd)
To enable authentication into an SSH server on Windows, you first have to generate host keys and repair the ACL on the host keys.
To configure the OpenSSH Server, just run the following PowerShell commands:
# Generate Key
# Add Key
# Repair SSH Host Key Permissions
Repair-SshdHostKeyPermission -FilePath C:\Windows\System32\OpenSSH\ssh_host_ed25519_key
# Open firewall port
New-NetFirewallRule -Protocol TCP -LocalPort 22 -Direction Inbound -Action Allow -DisplayName SSH
# Consider to configure the Profile for the Firewall rule
Now you should be able to access your Windows Server using an SSH client.
Remember if you run your server in Microsoft Azure, you might also need to configure the Network Security Group to allow SSH Remoting on port 22.
I hope this post help you and if you have any questions, please let me know in the comments.