Set up an SFTP server on Windows by using OpenSSH

Page creation date :

Operating environment

Windows
  • Windows 10 Pro
  • Windows Server 2019
  • More Windows
OpenSSH
  • 7.7p1
  • 8.1p1 - Beta

※ It works in other versions, but it is unconfirmed

At first

SFTP is a mechanism for sending and receiving files between two PCs (usually divided into clients and servers).

This standard is commonly referred to as "FTP", but FTP sends and receives the contents of the transmission and reception in plain text (unencrypted data). It may be easily read by third parties.

SFTP uses an encryption technique called "SSH" to encrypt the contents of FTP transmission and reception. It can be difficult for third parties to read.

This section describes the steps to set up SFTP server-side using the free OpenSSH.

How to install OpenSSH servers in Windows 10, Windows Server 2019 and later

Windows 10 makes it easy to install OpenSSH servers.

Open "Settings" from the Start menu.

image

Select Apps.

image

Select Optional Features from Apps and Features.

image

Select Add Features.

image

Select Install from the OpenSSH server.

image

The item disappears, so it returns to the previous screen.

image

The OpenSSH server is installed.

image

If you add it to the list, you're done.

image

OpenSSH server installation instructions on other Windows OS

Downloads and file placement

The Windows version of OpenSSH is now available, so download and set it up.

Download the file from the following pages: Download "OpenSSH-Win32.zip" for 32-bit OS and "OpenSSH-Win64.zip" for 32-bit OS. You can use the latest version, but at the moment they are all Beta versions.

image

Log in to the server and place the downloaded and deployed files on the server. It doesn't matter where it is, but this time I created a "C:\OpenSSH" folder and placed it there.

image

Environment variables

Register environment variables to make OpenSSH easier to work with. This section is described in Windows Server 2012 R2, but the steps should be tailored to the OS version.

Right-click on the Start menu and select System.

image

Select Advanced System Settings.

image

Click the "Environment Variables" button from the "Advanced Settings" tab.

image

Select Path in "System Environment Variables" and click the "Edit" button.

image

"at the top of the variable value" Semicolon, followed by the path of the folder where the OpenSSH file was placed. Once you have entered it, close everything with the "OK" button.

image

Set up the OpenSSH service

Start PowerShell with administrator rights.

image

Use the cd command to navigate to the OpenSSH folder and type .\install-sshd.ps1 to run it.

image

If it is displayed as "SUCCESS", it is OK.

image

You can verify that openSSH-related services have been configured.

image

You now have the setup almost the same as you installed OpenSSH in Windows 10. Next time, I would like to actually set sftp and send and receive files.