-
Download the latest OpenSSH release from Microsoft’s Powershell Gallery on github.
-
Install OpenSSH with the following command:
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
- Set Firewall rule on server:
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
- Start firewall service:
net start sshd
- Make startup type for sshd service to automatic
Set-Service sshd -StartupType Automatic
Here is the above commands and outputs in action:
Enabling SSH with password authentication (not recommended)
-
Stop sshd service and modify the sshd_config file in C:\Program Files\OpenSSH
-
Allow Password Authentication by uncommenting the line below:
Only allow access via Active Directory Security Group. In this example access is limited to Active Directory users that are apart of lab\sshusers group.
- Modify the ssh firewall rule for remote connections to only accept traffic over SFTP via Port 22 to subnets that need access an example is below:
Installation of OpenSSH For Windows Server 2019 and Windows 10
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse