How to Setup SFTP Server on Windows Server using OpenSSH Free

How to Setup SFTP Server on Windows Server using OpenSSH Free. While sending data over the internet, people usually suffer from many threats. Malicious attackers are always ready to hamper the data send from one place to another.

You may be aware of what I’m talking about: an FTP connection. With an FTP client you can connect one device to another to transfer your data over a network.

But using FTP protocol could not be safe enough sometimes, so what is better file transfer protocol? The better wireless transfer protocol is called SFTP. The S in SFTP stands for secure. It encrypts the connection’s login information during data transfer. 

If you want to keep your data safe, it is essential to use an SFTP server, a tool that provides security to data in transit.

In this post, we will introduce SFTP with its main advantages and then move on to the installation and configuration phase on the Windows server with OpenSSH.

What Is SFTP Server?

Secure File Transfer Protocol or SFTP Server is a protocol that helps you in transferring files securely. Simply put, it is a way of transferring files between a machine over a secure connection.

This transfer can be performed between server to server or client to server configurations. Therefore, with the help of this protocol, you can send confidential files securely over the networks or insecure networks.

Let’s explore how SFTP works in sending files securely from one place to another.  The SFTP uses a secure shell data stream that aids in establishing a secure connection and provides a higher level of protection for data while transferring it.

It also uses different encryptions that ensure the data remains unread while moving the data. However, you need to create SSH keys in advance to ignore fraud people from connecting to the server.

Advantages Of SFTP Server

There are following advantages that the SFTP Server provides: 

Immediate And Effective

With the help of the SFTP server, you can transfer large files easily and effectively. It enables you to transfer multiple files from one server to another in a single go, because of which you tend to save a lot of time. Enterprises using SFTP servers considered it a much better method than emails or cloud. They find exchanging of documents, forms and business critical files to the customer effortless.

Strengthens Data Accessibility

The services that the SFTP or Secure File Transfer Protocol provides are for both client applications and other SFTP servers. It satisfies user to server and server to server facilities. It enables you to foster collaboration and increased productivity of your organization by making data effortlessly accessible.

Improves speed and efficiency in business

Large file transfers are supported by SFTP servers support as well as bulk file transfers. It saves time and leads to better file transfer/sharing methods like email or cloud based solutions.

Fewer Risks

When using SFTP Server you also get encryption, public key authentication, data integrity, and host authentication. It encrypts all the data before transferring, making it non decipherable. It can be decrypted only by the receiver. Authenticating a public key helps you ensure that no imposter is making use of the intended data. For this purpose, you need to provide the receiver with usernames and passwords. This SFTP server also checks whether the data is coming from a trusted source. It verifies both the client and the source before establishing the connection.

SFTP Encryption

Encryption is a strong part of Secure File Transfer Protocol. It secures it from unauthorized access or hackers. Then it converts it into an unreadable format during transmission process, so it’s unreadable. The SSH Encryption is used during the file transfer to secure the process of transfer.

Helps In Achieving Compliance

There are laws that contain provisions that require covered entities to implement secure file transfers. If these protocols fail to comply with the security requirements, that could lead to costly penalties, which can damage your reputation. Not only the SFTP server is built with encryptions but also other security mechanisms, that help in satisfying certain regulatory requirements.

Follow this post to show you how to setup SFTP server on Windows server using OpenSSH free.

What is OpenSSH

The OpenSSH is the open source version of the Secure Shell (SSH) tools for remote login. What it does it encrypts all traffic to prevent attacks. Also the OpenSSH offers a large suite of secure tunnelling capabilities, authentication and configuration options.

Setup SFTP Server on Windows with OpenSSH


  • A user with administrative privileges.
  • Minimum 4 GB of RAM with 2 Cores CPU.

Install OpenSSH Server

To start, the SFTP uses an SSH protocol to transfer files securely between two machines. So you will need to install an OpenSSH server on your Windows server. You can install an OpenSSH server via PowerShell.

Firstly, open the PowerShell window as an administrator, then run the following command to check whether an OpenSSH is installed or not:

					Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'

You should see the following output:

					Name  : OpenSSH.Client~~~~
State : NotPresent

Name  : OpenSSH.Server~~~~
State : NotPresent


As you can see that an OpenSSH server or client is not installed on your server.

Please run the following command to install the OpenSSH server on your machine:

					Add-WindowsCapability -Online -Name OpenSSH.Server~~~~

Once the OpenSSH server is installed, you will get the following output:

					Path          : 
Online        : True
RestartNeeded : False


At this point, the OpenSSH server is installed on your server. You can now proceed to configure the OpenSSH server.

Configure OpenSSH Server

After the successful installation, you will need to start the OpenSSH service. You can start it using the following command:

					Start-Service sshd

Enable the OpenSSH service to start after the system reboot. You can do it using the following command:

					Set-Service -Name sshd -StartupType 'Automatic'

During the OpenSSH installation, the Firewall rule for SSH was configured automatically. You can check it by running the following command:

					Get-NetFirewallRule -Name *ssh*

You should see the following output:

					Name                          : OpenSSH-Server-In-TCP
DisplayName                   : OpenSSH SSH Server (sshd)
Description                   : Inbound rule for OpenSSH SSH Server (sshd)
DisplayGroup                  : OpenSSH Server
Group                         : OpenSSH Server
Enabled                       : True
Profile                       : Any
Platform                      : {}
Direction                     : Inbound
Action                        : Allow
EdgeTraversalPolicy           : Block
LooseSourceMapping            : False
LocalOnlyMapping              : False
Owner                         : 
PrimaryStatus                 : OK
Status                        : The rule was parsed successfully from the store. (65536)
EnforcementStatus             : NotApplicable
PolicyStoreSource             : PersistentStore
PolicyStoreSourceType         : Local
RemoteDynamicKeywordAddresses : {}


Set PowerShell as the default for OpenSSH. You can do it by running the following command:

					New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

The following output should be like this:

					DefaultShell : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE
PSChildName  : OpenSSH
PSDrive      : HKLM
PSProvider   : Microsoft.PowerShell.Core\Registry


Verify OpenSSH Connection

At this point the OpenSSH server is installed, configured and listens on port 22 on the Windows server. Now, you will need to verify the SSH connection from the remote Linux machine.

On the Linux machine, open your terminal and run the following command to connect to the OpenSSH server:

					ssh username@windows-sftp-server-ip

You will be asked to provide the password of the Windows user:

					The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:V6qNABiAL3Ni5viQWM8FV4eMH7IDuoign8kiXUwJ9LQ.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (ECDSA) to the list of known hosts.
ftpuser@'s password: 


Provide your password and press the Enter key. Once you are connected to the OpenSSH server. You should get the following shell:

					Microsoft Windows [Version 10.0.20348.502]
(c) Microsoft Corporation. All rights reserved.

ftpuser@CLOUD-JET35GPBR C:\Users\ftpuser>


Verify all files and directories of the Windows user using the following command:


You shall get the following output:

					 Volume in drive C has no label.
 Volume Serial Number is 24D4-E65B

 Directory of C:\Users\ftpuser

07/10/2022  07:48 AM    <DIR>          .
07/10/2022  07:48 AM    <DIR>          ..
05/08/2021  08:20 AM    <DIR>          Desktop
07/10/2022  07:48 AM    <DIR>          Documents
05/08/2021  08:20 AM    <DIR>          Downloads
05/08/2021  08:20 AM    <DIR>          Favorites
05/08/2021  08:20 AM    <DIR>          Links
05/08/2021  08:20 AM    <DIR>          Music
05/08/2021  08:20 AM    <DIR>          Pictures
05/08/2021  08:20 AM    <DIR>          Saved Games
05/08/2021  08:20 AM    <DIR>          Videos
               0 File(s)              0 bytes
              11 Dir(s)  71,437,893,632 bytes free


Test the SFTP Server

To connect to the SFTP server, you will need an SFTP client on the remote PC. There are many SFTP client tools available to connect to the SFTP server. In this tutorial, we will use FileZilla to connect to the SFTP server.

1.First, open the FileZilla client on the remote PC. You should see the FileZilla interface on the following screen:

2.Now, click on the Site Manager to create a new SFTP connection. You should see the following screen:

3.Provide your SFTP server IP, Port, select SFTP from the dropdown, username, password, and click the OK button. Once you are connected to the SFTP server. You will get the following screen:

From here, you can easily download and upload files to and from the SFTP server.

How to Setup SFTP Server on Windows Server using OpenSSH Free Conclusion

In this post, we explained how to set up an SFTP server using the OpenSSH free on Windows server. Compared to an FTP server, an SFTP server is a very secured protocol that uses a secure shell data stream and provides a higher level of protection for data transfer  between machines. I hope you can now easily set up your own SFTP server to upload and download files from the remote machine.

Please read more of our content on FTP server here. I hope you have enjoyed this article and please do not hesitate to contact us for further assistance. 

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

5 1 vote
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x