Configure OpenSSH SFTP on Windows 2019

Now that I have OpenSSH installed, the next step(s) is(are) to Configure OpenSSH SFTP on Windows 2019.

In my case, I had errors during the install, but I now have it installed and I am following the default configuration commands from Microsoft’s documentation.

First up I confirmed the OpenSSH Client and Server are installed:

PS C:\windows\system32> Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

Name  : OpenSSH.Client~~~~0.0.1.0
State : Installed

Name  : OpenSSH.Server~~~~0.0.1.0
State : Installed

and then I start / install the server as a service:

PS C:\windows\system32> Start-Service sshd
PS C:\windows\system32> Set-Service -Name sshd -StartupType 'Automatic'
PS C:\windows\system32> Set-Service -Name sshd -StartupType 'Automatic'
PS C:\windows\system32> if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
>>     Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
>>     New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
>> } else {
>>     Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
>> }
Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists.
PS C:\windows\system32>

Ok, so that is the first couple of steps, done via copy/paste from the MS instructions. Although I do want to come back to the use of Port 22 as the default. I’ll also need to adjust the ports on the hardware firewall to allow for external SFTP access, but that can come later.

A quick test using PowerShell on my local Windows 10 machine shows that a connection to the server will complete as described, so far success!

Changing the ports took a bit more than I hoped so I documented Changing the SSH Port as well.

Leave a Reply

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