Installing SSH Server

Installing SFTP/SSH Server

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

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)’ -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

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 sshd 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 sshd service by clicking the Start the service.

Setting up SSH public key authentication

Follow a generic guide for Setting up SSH public key authentication in *nix OpenSSH server, with the following difference:

Create the .ssh folder (for the authorized_keys file) in your Windows account profile folder (typically in C:Usersusername.ssh).2

For permissions to .ssh folder and authorized_keys file, what matters are Windows ACL permissions, not simple *nix permissions. Set the ACL so that only a respective Windows account have a write access to the folder and the file (what is the default access level, if you create the folder and the file, while logged in using the respective account).