Installing SFTP/SSH Server on Windows using OpenSSH

Installing SFTP/SSH Server

1. On Windows 10 version 1803 and newer


In Settings app, go to Apps > Apps & features > Manage optional features.
Locate “OpenSSH server” feature, expand it, and select Install.
Binaries are installed to %WINDIR%System32OpenSSH. 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.

2. On earlier versions of Windows

Download the latest OpenSSH for Windows binaries (package OpenSSH-Win64.zip or OpenSSH-Win32.zip)
As the Administrator, extract the package to C:Program FilesOpenSSH
As the Administrator, install sshd and ssh-agent services:
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1


Configuring SSH server

    Allow incoming connections to SSH server in Windows Firewall:
    1. Either run the following PowerShell command (Windows 8 and 2012 or newer only), as the Administrator: 

New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH SSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

  2. 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:
  1. Go to Control Panel > System and Security > Administrative Tools and open Services. Locate OpenSSH SSH Server service.
  2. 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.
  3. Start the OpenSSH SSH Server service by clicking the Start the service.
原文地址:https://www.cnblogs.com/xingfuxiaokong/p/11466357.html