Host SFTP Server Windows 10

Hello Dev, in this article we will discuss how to host SFTP server on Windows 10. SFTP server enables secure file transfer between computers over an encrypted and secure connection. We will provide you with a step-by-step guide on how to set up your own SFTP server on your Windows 10 device.

Requirements

In order to set up an SFTP server on your Windows 10 device, you will need to have the following:

  • A Windows 10 operating system
  • Internet connection
  • Administrative privileges
  • An SFTP client, such as FileZilla

Step-by-Step Guide

Step 1: Install OpenSSH Server

The first step is to install OpenSSH Server on your Windows 10 device. OpenSSH is an open source tool that provides SSH connectivity to your device. To install OpenSSH, follow these steps:

  1. Press the Windows key + X and select Windows PowerShell (Admin) from the dropdown menu.
  2. Type the following command: Get-WindowsCapability -Online | ? Name -like 'OpenSSH.Server*' | Add-WindowsCapability -Online
  3. Press Enter and wait for the package installation to complete.

Step 2: Configure Firewall

Make sure to configure your firewall settings to allow traffic on port 22. This is the default port used for SFTP connections. Follow these steps:

  1. Press the Windows key + R and type WF.msc and press Enter to open Windows Defender Firewall with Advanced Security.
  2. Select Inbound Rules and click on New Rule…
  3. Select Port and click Next.
  4. Select TCP and enter 22 as the specific port. Click Next.
  5. Select Allow the connection and click Next.
  6. Select the profiles for which the rule applies, and click Next.
  7. Name the rule and click Finish.

Step 3: Create SFTP User

The next step is to create an SFTP user which will be used to authenticate and access your SFTP server. Follow these steps:

  1. Open Command Prompt as Administrator.
  2. Type net user username password /add where “username” is the name of your SFTP user, and “password” is the password you want to set for that user.
  3. Type net localgroup sshusers username /add to add the user to the sshusers group.

Step 4: Configure SFTP Server

Now that you have installed OpenSSH Server, configured your firewall, and created an SFTP user, it’s time to configure your SFTP server. Follow these steps:

  1. Press the Windows key + R and type regedit to open the Registry Editor.
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH. If this key does not exist, right-click on the SOFTWARE key and select New -> Key. Name the key “OpenSSH”.
  3. Right-click on the OpenSSH key and select New -> String Value. Name this value “DefaultShell”.
  4. Double-click on the DefaultShell value and enter the path to your SFTP client executable (e.g. C:\Program Files\FileZilla FTP Client\filezilla.exe).
  5. Right-click on the OpenSSH key and select New -> String Value. Name this value “ForceCommand”.
  6. Double-click on the ForceCommand value and enter the following: internal-sftp

Connecting to Your SFTP Server

Now that you have set up your SFTP server, it’s time to connect to it using an SFTP client. Follow these steps:

  1. Open your SFTP client.
  2. Enter the hostname or IP address of your Windows 10 device as the server address.
  3. Enter the SFTP user credentials you created in Step 3.
  4. Enter port 22 as the port number.
  5. Connect to the server.
READ ALSO  DayZ: How to Host Your Own Server

FAQ

Question
Answer
Can I use a different port for my SFTP server?
Yes, you can use a different port by modifying the Windows Defender Firewall rule in Step 2 and specifying a different port number. Be sure to use the same port number in your SFTP client when connecting to the server.
What if I forget my SFTP user password?
You can reset your SFTP user password by opening Command Prompt as Administrator and typing net user username *, where “username” is the name of your SFTP user. You will be prompted to enter a new password.
Can I restrict SFTP user access to specific directories?
Yes, you can restrict SFTP user access to specific directories by modifying the user’s permissions. To do this, follow these steps:
  1. Open Command Prompt as Administrator.
  2. Type icacls "C:\path\to\folder" /grant username:r /t, where “C:\path\to\folder” is the path to the folder you want to restrict access to, and “username” is the name of the SFTP user you want to restrict access for.

That’s it Dev, you now have a secure SFTP server hosted on your Windows 10 device. Happy file transferring!