SFTP uses SSH protocol, so first we have to install windows version of openssh the server.
Luckily we get the precompiled version of it, so we just have to unzip the contents to a folder. Please note that this installation should be used only in a non-prod environment.
Download link : https://github.com/PowerShell/Win32-OpenSSH/releases/download/3_19_2016/OpenSSH-Win64-1.1.zip (I find that the latest versions give a 1067 error while starting)
Steps:
Inside PowerShell prompt execute below command to bypass execution restrictions:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
cd c:\OpenSSH-Win
.\install-sshlsa.ps1
reboot server
Once server is up, edit c:\OpenSSH-Win\sshd_config
Modify below line in config file:
subsystem sftp c:\OpenSSH-Win\sftp-server.exe -d C:/Users/ftp-testing/Work
-d –> default working directory for ftp logins
Open cmd in elevated rights
cd c:\OpenSSH-Win
sshd.exe install
It will show installation successful.
Open services.msc and go to sshd
Make sure sshd starts “Automatically”
Generate SSH keys for the server (they are necessary to start sshd):
ssh-keygen.exe –A
Start SSHD service
Connect ssh using some client tools, like, winscp.