Home Cloud Serevrs Set Up an SFTP Server on a Windows VPS (Using OpenSSH)

Set Up an SFTP Server on a Windows VPS (Using OpenSSH)

Last updated on Feb 13, 2025

Secure File Transfer Protocol (SFTP) allows you to transfer files between your local computer and a Windows VPS securely. This guide will walk you through installing, configuring, and securing an SFTP server on your Windows Server VPS using OpenSSH.


📌 Prerequisites

  • A Windows Server VPS (2016, 2019, or 2022) from VolticHost

  • Administrator access

  • Ports 22 open in the firewall


1️⃣ Install OpenSSH on Windows Server

  1. Open PowerShell as Administrator.

  2. Run the following command to install OpenSSH:

    Add-WindowsFeature -Name OpenSSH-Server
    
    
  3. Once installed, start the OpenSSH service:

    Start-Service sshd
    
    
  4. Enable the service to start on boot:

    Set-Service -Name sshd -StartupType Automatic
    
    
  5. Verify that OpenSSH is running:

    Get-Service sshd
    
    

OpenSSH is now installed and running!


2️⃣ Configure Windows Firewall for SFTP

  1. Open Windows Defender Firewall (Win + R, type wf.msc, press Enter).

  2. Click Advanced SettingsInbound RulesNew Rule.

  3. Select Port, then click Next.

  4. Choose TCP, enter 22, then click Next.

  5. Select Allow the connection, then click Next again.

  6. Apply to Domain, Private, and Public networks.

  7. Name the rule SFTP Port 22 and click Finish.

Your firewall now allows SFTP connections!


3️⃣ Create an SFTP User

  1. Open Command Prompt (Admin).

  2. Create a new user (replace sftpuser with your preferred username):

    net user sftpuser YourStrongPassword /add
    
    
  3. Add the user to the "SFTP Users" group (create it if it doesn't exist):

    net localgroup "SFTP Users" /add
    net localgroup "SFTP Users" sftpuser /add
    
    
  4. Create a folder for SFTP file storage:

    mkdir C:\SFTP\sftpuser
    
    
  5. Set permissions so only the user can access the folder:

    icacls C:\SFTP\sftpuser /grant sftpuser:F
    
    

Your SFTP user is now set up!


4️⃣ Configure OpenSSH for SFTP Access

  1. Open PowerShell as Administrator.

  2. Edit the SSH configuration file:

    notepad C:\ProgramData\ssh\sshd_config
    
    
  3. Scroll to the bottom and add the following lines:

    Match Group "SFTP Users"
        ChrootDirectory C:\SFTP
        ForceCommand internal-sftp
        AllowTcpForwarding no
        X11Forwarding no
    
    
  4. Save and close the file.

  5. Restart the SSH service to apply changes:

    Restart-Service sshd
    
    

Your OpenSSH server is now configured for SFTP!


5️⃣ Connect to Your SFTP Server

Using FileZilla (GUI-Based)

  1. Download and install FileZilla from https://filezilla-project.org.

  2. Open FileZilla and click FileSite Manager.

  3. Click New Site and enter the following details:

    • Host: Your VPS IP

    • Port: 22

    • Protocol: SFTP - SSH File Transfer Protocol

    • Logon Type: Normal

    • Username: sftpuser

    • Password: Your password

  4. Click Connect to access your SFTP server.

You can now transfer files securely!


6️⃣ Secure Your SFTP Server (Recommended)

Change the Default SSH Port (Optional for Security)

To prevent unauthorized access, change the SSH port from 22 to a custom port (e.g., 2222):

  1. Open PowerShell and edit the SSH config:

    notepad C:\ProgramData\ssh\sshd_config
    
    
  2. Find the line:

    #Port 22
    
    
  3. Change it to:

    Port 2222
    
    
  4. Save the file and restart the SSH service:

    Restart-Service sshd
    
    
  5. Open Windows Firewall and allow the new port (2222).

Your SFTP server is now more secure!


🎉 Conclusion

You've successfully set up an SFTP server on a Windows VPS using OpenSSH! You can now securely transfer files between your local machine and your VPS. 🚀

For more assistance, contact VolticHost Support.