Installing and Configuring SFTP/SSH/SCP Server on Windows Using OpenSSH

Share This:

OpenSSH Windows

Microsoft has added the ability to install an OpenSSH SFTP/SSH Server in Windows 10, Windows 11, Windows Server 2019, and Windows Server 2022. It can be added via Powershell or as a Windows Optional Feature.

Install OpenSSH Server via GUI

  • Go to Settings > Apps > Optional features and click on View features
  • Locate the OpenSSH server feature, select it, click Next, and then click Install

Install OpenSSH Server via Powershell

  • Run Powershell as an admin
  • Run the command:
    Add-WindowsCapability -Online -Name OpenSSH.Server~~~~
  • If you’re going to use key-based authentication, you’ll also want to run this command to install tools that will help configure it:
    Install-Module -Force OpenSSHUtils -Scope AllUsers

If you get an error 0x800f0954, check out the article How to Fix Add-WindowsCapability failed Error code = 0x800f0954.

Other OpenSSH Server Information

The binaries are installed to %WINDIR%\System32\OpenSSH. The configuration file (sshd_config) and host keys are installed to %ProgramData%\ssh. The ssh folder will only contain information after the service is started for the first time.

By default, the service is set to Manual startup. You’ll need to go into Services and find OpenSSH Server and change the Startup Type to Automatic if you want it to start when Windows starts.

Notes in the sshd_config file

Any changes to this file need to be made with an administrator account and the service needs to be restarted after changes are saved. You can run Notepad as an administrator, then navigate to %ProgramData%\ssh\sshd_config.

If you want to change the port, remove the comment (#) in front of the “Port 22” line and change the port number.

If you want to use a different key type for the Host Key, remove the comment (#) in front of the HostKey line you want to use, for example “#HostKey __PROGRAMDATA__/ssh/ssh_host_rsa_key”.

Share This:


Leave a Reply