Installing SFTP/SSH Server on Windows using OpenSSH

Natively from Microsoft https://winscp.net/eng/docs/guide_windows_openssh_server 

Working with Cywin (so we could use password less and rsync backup from window to linux box) : https://www.mls-software.com/files/setupssh-7.6p1-1.exe

Recently, Microsoft has released an early version of OpenSSH for Windows. You can use the package to set up an SFTP/SSH server on Windows.

Installing SFTP/SSH Server

  • Download the latest OpenSSH for Windows binaries (package OpenSSH-Win64.zip or OpenSSH-Win32.zip)
  • 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
  • As the Administrator, generate server keys and restrict an access to them, by running the following commands from the C:\Program Files\OpenSSH directory:
    .\ssh-keygen.exe -A
    powershell.exe -ExecutionPolicy Bypass -Command ". .\FixHostFilePermissions.ps1 -Confirm:$false"
  • Allow incoming connections to SSH server in Windows Firewall:
    • Either run the following PowerShell command (Windows 8 and 2012 or newer only), as the Administrator:
      New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Service sshd -Enabled True -Direction Inbound -Protocol TCP -Action Allow
    • or go to Control Panel > System and Security > Windows Firewall1 > Advanced Settings > Inbound Rules and add a new rule for sshd service (or port 22).