If you want to be able to scp files to your Windows machine from a Linux machine you will have to have something listening for that inbound traffic. Luckily setting up a daemon to listen on port 22 for ssh calls is not hard to do.

1. Download

Go to the latest release page of PowerShell’s OpenSSH and download it. With your favorite tool, extract the folder to C:\Program Files\ and rename it OpenSSH.

2. Install

Now start the Windows PowerShell ‘As Administrator’ and move into the directory:

searching in windows bar for powershell

cd 'C:\Program Files\OpenSSH

Now we install both ssh-agent and sshd (the daemon):

powershell -executionpolicy bypass -file install-sshd.ps1

Then set up the ssh host keys that are required by the daemon when it starts:

.\ssh-keygen.exe -A

3. Configure

Firewall

First we need to allow the incoming traffic through the firewall. To do so, search for “Windows Firewall” and select “Windows Firewall with Advanced Security”:

Windows Firewall with Advanced Security

Then select Inbound Rules > New Rule… and follow then select Port and click Next:

Select Port

Select TCP protocol and Specific local port(s) with a value of 22 then click Next:

TCP protocol and port 22

I’ve elected to allow all connections since I will only accept traffic when on secure networks (the next step). Make your choice and click Next:

all connections

I’ve elected to only allow traffic on private and my corporate networks. Make your choice and then click Next:

private and corporate networks

Now choose a name, like “OpenSSH” for the rule and click Finish.

Automatic Start

If you would like the services to start automatically every time you boot the computer, run these two commands in the PowerShell as administrator:

Set-Service sshd -StartupType Automatic
Set-Service ssh-agent -StartupType Automatic

Path

If you’re going to be starting and stopping the services manually, chances are you’ll be doing it from the command line instead of the Services application. If that is the case, don’t forget to append the installation directory to your path in the Environment Variables application.

4. Confirm Your Install

If the services are running you can check your Task Manager to see if ssh-agent and sshd are present with process IDs:

ssh-agent and sshd running

Now try scping from a remote host to check the firewall settings. Make sure you’re meeting the rules for the incoming connection that you set with the firewall (e.g. don’t try connecting when on a public network):

mlegge@IMPERATORIS1:~
$ ssh mlegge@DESKTOP
mlegge@DESKTOP's password:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

mlegge@DESKTOP C:\Users\mlegge> exit
Connection to DESKTOP closed.
mlegge@IMPERATORIS1:~

Hope you find this useful!