Installing SFTP/SSH Server on Windows using OpenSSH
Recently, Microsoft has released a port of OpenSSH for Windows. You can use the package to set up an SFTP/SSH server on Windows.Installing SFTP/SSH Server

On Windows 10 version 1803 and newer
On earlier versions of Windows 

Configuring SSH server
Setting up SSH public key authentication
Connecting to the server

Finding Host Key

Further readingInstalling SFTP/SSH Server
On Windows 10 version 1803 and newerIn Settings app, go to Apps > Apps & features > Manage optional features.

Locate “OpenSSH server” feature, expand it, and select Install.Binaries are installed to %WINDIR%\System32\OpenSSH. 
Configuration file (sshd_config) and host keys are installed to %ProgramData%\ssh
 (only after the server is started for the first time).
You may still want to use the following manual installation, if you want to install a newer version of OpenSSH than the one built into Windows 10.

On earlier versions of WindowsDownload the latest OpenSSH for Windows binaries (package or

As the Administrator, extract the package to C:\Program Files\OpenSSH
As the Administrator, install sshd and ssh-agent services:
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
Configuring SSH serverAllow incoming connections to SSH server in Windows Firewall:

When installed as an optional feature, the firewall rule “OpenSSH SSH Server (sshd)” should have been created automatically. If not, proceed to create and enable the rule as follows.
Either run the following PowerShell command as the Administrator:New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH SSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -Program "C:\System32\OpenSSH\sshd.exe"

Replace C:\System32\OpenSSH\sshd.exe with the actual path to the sshd.exe 
(C:\Program Files\OpenSSH\ssh.exe, 
had you followed the manual installation instructions above).or go to Control Panel > System and Security > Windows Firewall1 > Advanced Settings > Inbound Rules and add a new rule for port 22.

Start the service and/or configure automatic start:

Go to Control Panel > System and Security > Administrative Tools and open Services. Locate OpenSSH SSH Server service.

If you want the server to start automatically when your machine is started: Go to Action > Properties. In the Properties dialog, change Startup type to Automatic and confirm.

Start the OpenSSH SSH Server service by clicking the Start the service.These instructions are partially based on the official deployment instructions.

0 个评论