To set up an SFTP server on Windows 11 or Windows Server, enable the Windows OpenSSH Server feature, start sshd, check the firewall, and test an actual upload. SFTP uses SSH (normally TCP port 22); you do not install a separate FTP server.
The basic setup uses an ordinary Windows account. For external users or tightly scoped file transfers, add a separate SFTP-only account with a local chroot directory and carefully verified NTFS permissions.
Use our separate Linux SFTP server setup guide. Linux ownership rules and chmod instructions do not apply to Windows NTFS permissions.
| What you need | What Windows provides |
|---|---|
| To host SFTP | OpenSSH.Server, running as the sshd service |
| To connect to SFTP | OpenSSH.Client (sftp.exe) or a GUI client |
| To restrict file access | Windows account permissions, NTFS ACLs, optionally ForceCommand internal-sftp and ChrootDirectory |
Version note: Windows Server 2025 includes OpenSSH by default, although its service still needs to be enabled. Windows 10 can run OpenSSH, but standard support for most Windows 10 editions ended on October 14, 2025. Avoid deploying a new internet-facing file server on an unsupported Windows installation without an applicable extended-security-update arrangement.
Step 1: Install OpenSSH Server on Windows
Run these commands in an elevated PowerShell window on the Windows machine that will receive files. Confirm that you are checking the Server capability: OpenSSH.Client alone only lets Windows connect outward.
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*' | Select-Object Name, State
# Only if OpenSSH.Server is NotPresent:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
A normal result after installation is OpenSSH.Server~~~~0.0.1.0 with State : Installed. Installation can require Windows Update or an approved Features on Demand source; do not assume a generic installation-media drive is the right source for every build.
Windows 11 and Windows 10 graphical installation
Open Settings and search for Optional features. The location differs between Windows versions and updates; choose Add/View features, search for OpenSSH Server, then install it. On Windows Server 2019/2022 you can also use PowerShell. Windows Server 2025 has the component installed by default; you still need to enable and check sshd.
Follow the Microsoft installation guide for the current instructions for each Windows edition.
OpenSSH.Server with the Installed state, alongside the OpenSSH Client.Step 2: Start the sshd service and verify the listener
Windows SFTP is hosted by the same sshd service used for SSH shell access. Start it now, configure automatic startup, and inspect its state:
Start-Service sshd
Set-Service -Name sshd -StartupType Automatic
Get-Service sshd
Get-NetTCPConnection -LocalPort 22 -State Listen -ErrorAction SilentlyContinue
Get-Service sshd should report Running. The TCP listener check verifies whether a process is accepting connections on port 22, not whether an SFTP login will succeed. If SSH uses a custom port, replace 22.
On Windows Server 2025 you may also enable Remote SSH Access in Server Manager. If Start-Service sshd fails, diagnose the service and configuration before changing authentication or firewall settings.
Step 3: Allow the SSH/SFTP port in Windows Firewall
OpenSSH installation normally creates an inbound firewall rule called OpenSSH-Server-In-TCP. Inspect the rule first rather than blindly creating duplicates:
Get-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -ErrorAction SilentlyContinue |
Format-List Name, Enabled, Direction, Action, Profile
Get-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -ErrorAction SilentlyContinue |
Get-NetFirewallPortFilter
If no suitable inbound rule exists, an administrator can create one for TCP port 22. For a private lab, scope access to the trusted client addresses or network rather than allowing the entire internet:
# Only if the default OpenSSH rule does not exist:
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' `
-DisplayName 'OpenSSH Server (sshd)' -Enabled True `
-Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
When appropriate, narrow RemoteAddress or use the firewall GUI to restrict sources. An external client also needs a route to the server: a private home address cannot be reached from the internet without a VPN or an explicitly configured, secured network path. SFTP has no additional port to open.
sshd service, the applicable inbound firewall rule and local SSH connectivity. Local port checks do not prove that other computers can connect.Step 4: Verify the SFTP subsystem and configuration
The server reads its OpenSSH settings from C:\ProgramData\ssh\sshd_config. In PowerShell, use $env:ProgramData rather than typing a literal %ProgramData% path (that variable syntax belongs to Command Prompt).
$config = Join-Path $env:ProgramData 'ssh\sshd_config'
Select-String -Path $config -Pattern '^\s*Subsystem\s+sftp'
Test-Path "$env:WINDIR\System32\OpenSSH\sftp-server.exe"
The Windows OpenSSH default commonly uses Subsystem sftp sftp-server.exe; internal-sftp is another implementation. Keep the existing working subsystem entry. Do not add a second Subsystem sftp directive.
After any configuration edit, validate before restarting the service:
& "$env:WINDIR\System32\OpenSSH\sshd.exe" -t
# Only when the syntax check succeeds AND you have a recovery path:
Restart-Service sshd
Run these as administrator and keep a recovery route available. sshd -t checks config syntax; it does not prove that every account can authenticate or upload files. Windows may log operational events under an OpenSSH channel in Event Viewer; see the logging section below.
Subsystem sftp directive and a successful sshd.exe -t syntax check.Step 5: Connect and verify upload and download
First verify file transfers locally on the Windows server using localhost. If other computers need access, test again from a second authorized device using the Windows server’s actual address. Prefer a non-administrator account with access to a disposable test directory; you may use an existing approved user or create a dedicated test account.
Optional: create a separate test account on the Windows server
# Only if you need a NEW local account; run as administrator:
New-LocalUser -Name 'sftpdemo' `
-Password (Read-Host 'Set a test password' -AsSecureString) `
-Description 'SSHFlow SFTP test account'
Get-LocalUser -Name 'sftpdemo' | Select-Object Name, Enabled
Your organization's Windows account policy may disallow password logins or require domain identities. Do not weaken the global SSH policy for a screenshot; use an account and authentication method already permitted by the server.
Connect from Windows PowerShell or Linux/macOS
For the local test, run the following from PowerShell on the Windows server. It connects back to the same machine. Use the Windows account password if prompted, not a Windows Hello PIN:
Set-Location $HOME
'SSHFlow Windows SFTP test' | Set-Content -Encoding ascii 'sftp-win-test.txt'
sftp "$($env:USERNAME)@localhost"
To test access from another computer, create the same local test file on that client, then connect to the Windows server with your permitted account, for example sftp sftpdemo@SERVER_IP when you created sftpdemo. A different computer requires network reachability and a suitable inbound firewall rule.
At the interactive sftp> prompt, upload and download it. On a remote Windows server, pwd may display a translated path rather than a Unix home directory; that is normal:
pwd
ls
put sftp-win-test.txt
ls -l sftp-win-test.txt
get sftp-win-test.txt sftp-win-test-downloaded.txt
exit
If you started SFTP in a different local directory, use the full forward-slash local file path for put, or set the local SFTP working directory using lcd. A successful put/get confirms more than TCP reachability or an SSH login.
Validate local and remote TCP reachability separately
# On the Windows server:
Test-NetConnection -ComputerName 127.0.0.1 -Port 22
# On another machine, using the server's real address:
Test-NetConnection -ComputerName SERVER_IP -Port 22
TcpTestSucceeded : True means a TCP connection was established. It does not prove a valid SFTP subsystem or write permissions. For custom SSH ports use uppercase -P in sftp -P 2222 sftpdemo@SERVER_IP.
put to upload a test file, ls -l to inspect it and get to download it. A local localhost test verifies file transfer, but not remote-network reachability.SSH keys, Windows accounts, and safe access
Windows OpenSSH supports public-key authentication. A normal user usually has C:\Users\USERNAME\.ssh\authorized_keys; when Windows OpenSSH's default Match Group administrators rule is in effect, local administrator accounts use C:\ProgramData\ssh\administrators_authorized_keys instead. Verify the effective configuration rather than assuming every installation uses the default.
| Identity | Key location (typical default) |
|---|---|
| Regular Windows user | %USERPROFILE%\.ssh\authorized_keys in that user's profile |
| Administrator-group member | C:\ProgramData\ssh\administrators_authorized_keys, if the default administrator Match rule applies |
NTFS ACLs on keys matter. For administrators, Microsoft documents restricting the shared authorized-keys file to Administrators and SYSTEM. Do not make private keys publicly readable or disable key checks to debug authentication. Follow the Windows OpenSSH configuration reference and our authorized_keys guide.
For internet-facing services, prefer a dedicated least-privilege account, strong authentication, scoped firewall access, security updates, and monitoring. SFTP protects data in transit but does not prevent misuse of files that an authenticated account is allowed to access.
Optional: SFTP-only account and Windows chroot
For a vendor or automation account that must not browse the full server, Windows OpenSSH supports ChrootDirectory for SFTP sessions only. This is a different operation from Unix chown/chmod, and a plain cmd.exe or PowerShell shell does not enforce the chroot. Use ForceCommand internal-sftp to keep the account in file-transfer mode. Microsoft documents this behavior.
1. Create a dedicated local directory tree
# Run on the WINDOWS server in elevated PowerShell:
New-Item -ItemType Directory -Force 'C:\SFTPRoot\sftpdemo\uploads' | Out-Null
icacls.exe 'C:\SFTPRoot'
icacls.exe 'C:\SFTPRoot\sftpdemo'
icacls.exe 'C:\SFTPRoot\sftpdemo\uploads'
The chroot root and every relevant parent must be controlled by SYSTEM / Administrators; the restricted user must not have write access to the chroot root. Grant that user the necessary read/traverse rights to the jail and write/modify rights only to the nested uploads directory. icacls is shown read-only above; plan ownership and ACL changes for your actual Windows version before modifying them. Do not apply Linux-style 777 permissions or broadly grant Everyone:F.
2. Add a per-user Match block
In C:\ProgramData\ssh\sshd_config, keep the existing global Subsystem sftp ... line. Add the following near the end, after other global directives:
Match User sftpdemo
ChrootDirectory C:\SFTPRoot\sftpdemo
ForceCommand internal-sftp
PermitTTY no
DisableForwarding yes
Use a lowercase, exact Windows account name, and adjust the local path and account. In current Windows OpenSSH, ForceCommand has version-specific nuances for PTY sessions, so PermitTTY no provides an additional explicit restriction. An SFTP-only account must be tested for both intended transfer access and absence of unintended shell access.
3. Validate, restart carefully, and test with real SFTP
& "$env:WINDIR\System32\OpenSSH\sshd.exe" -t
# Only after validating and keeping a recovery path:
Restart-Service sshd
# Review actual NTFS permissions:
icacls.exe 'C:\SFTPRoot\sftpdemo'
icacls.exe 'C:\SFTPRoot\sftpdemo\uploads'
From the client, connect with sftp sftpdemo@SERVER_IP, use ls, then cd uploads and upload a test file. An attempt to browse outside the chroot should not reveal the host filesystem. Windows account names, path handling and ACL inheritance vary by setup. Treat this as an optional advanced configuration and verify both file transfers and shell denial on your own server before using it for restricted accounts.
The Linux SFTP guide uses root:root, namei and chmod. A Windows chroot needs compatible NTFS ACLs and a valid account token. If you are not able to verify those permissions on a test instance, use a standard SFTP account with a tightly controlled folder first.
Connect with a graphical Windows SFTP client
Once the Windows server works with the built-in command-line client, connect with an SFTP GUI using the same host, port, username and authentication method. WinSCP, Bitvise and other SFTP clients provide visual file browsers; ShadeTerm combines remote files with terminals and editing in a per-server workspace.
ShadeTerm is an SFTP client, not the Windows SFTP server installed by this tutorial. A GUI client does not bypass the server's NTFS permissions or chroot restrictions.
Windows SFTP troubleshooting: errors, logs, and ACLs
Windows SFTP failures are often caused by a stopped sshd service, blocked TCP port, an invalid Subsystem sftp line, wrong account keys, or NTFS rights. Diagnose them in that order instead of repeatedly restarting the server.
| Symptom | Where to start |
|---|---|
| Connection refused | Get-Service sshd, port listener, firewall rule |
| Connection timed out | Route, network firewall, inbound rule scope |
| Permission denied (publickey) | Offered key, correct user, relevant authorized_keys, NTFS ACL |
| Subsystem request failed | Active Subsystem sftp line, sftp-server.exe, logs |
| Login works but upload fails | Write access to target folder, ACL inheritance, chroot rules |
| SFTP-only account sees wrong directory | Match User, ChrootDirectory, local path and ownership |
Read the OpenSSH event log
# First discover channels available on your Windows build:
Get-WinEvent -ListLog '*OpenSSH*' -ErrorAction SilentlyContinue
# Common channel if present:
Get-WinEvent -LogName 'OpenSSH/Operational' -MaxEvents 30 -ErrorAction SilentlyContinue |
Select-Object TimeCreated, Id, LevelDisplayName, Message
Windows OpenSSH's default logging can use Event Tracing for Windows (ETW). For file-based diagnostics, Microsoft documents a SyslogFacility LOCAL0 configuration that writes logs below %ProgramData%\ssh\logs. Raise log verbosity temporarily for a controlled debugging session, then restore it to avoid excessive sensitive connection metadata. Microsoft's Windows SFTP troubleshooting guide covers these cases.
If installation fails
On disconnected machines or systems managed by WSUS, installing an OpenSSH optional feature can require a compatible Features on Demand source. Use the documented procedure for your exact Windows release rather than copying a generic drive letter. Microsoft: Can't install OpenSSH features.
Frequently asked questions
Does Windows 11 include an SFTP server?
Windows 11 can provide SFTP through the optional OpenSSH Server capability. Install the server feature, start sshd, allow its SSH port, and test with sftp. Installing OpenSSH Client alone does not host an SFTP server.
Is the SFTP server free on Windows?
Windows OpenSSH Server is available as a built-in Windows capability. You still need a licensed, supported Windows machine and any associated infrastructure costs.
How do I set up SFTP on Windows Server 2025?
OpenSSH is installed by default on Windows Server 2025, but enable the sshd service, review the firewall rule, confirm the subsystem, and test file transfer. Server Manager exposes a Remote SSH Access setting.
What port does Windows SFTP use?
TCP 22 by default, because SFTP runs inside SSH. A non-default SSH port is also the SFTP port. Specify it with uppercase -P when using sftp.exe.
Does Windows File Explorer support SFTP?
Not as a native SFTP network drive in a standard Windows setup. Use OpenSSH's sftp.exe command or an SFTP-capable GUI client.
Does ChrootDirectory block a Windows SSH shell?
No. Microsoft's Windows OpenSSH documentation says ChrootDirectory is supported for SFTP sessions, not ordinary cmd.exe sessions. Configure ForceCommand internal-sftp and test that no shell is available.
Should I expose a Windows SFTP server directly to the internet?
Prefer trusted networks or a properly secured VPN and least-privilege accounts. If external access is required, maintain supported security updates, restrict firewall sources where possible, use strong authentication, and review logs.
Technical sources and further reading
The commands and Windows-specific limitations above are grounded in Microsoft's OpenSSH documentation. Interface labels can differ by Windows release, and security restrictions should always be checked against the installed version.
- Microsoft — Get started with OpenSSH for Windows: supported versions, service, firewall.
- Microsoft — OpenSSH Server configuration for Windows: config paths, keys, Match, chroot.
- Microsoft — Troubleshoot common SFTP issues: ACLs, chroot, Windows logs.
- WinSCP — Installing SFTP/SSH Server on Windows: GUI-oriented installation and connecting.
- Microsoft — Windows 10 end of support: lifecycle and updates.
Final check: test transfers, not just an open port
A Windows SFTP server is usable when the OpenSSH Server feature is installed, sshd runs, the firewall allows the intended clients, the SFTP subsystem is valid, and an actual Windows account can upload and download a file. Treat chroot as an additional, testable security configuration, not a checkbox.
If the receiving machine is Linux, see our dedicated Ubuntu/Debian SFTP setup. Once Windows SFTP works, ShadeTerm is an optional GUI for managing the remote files alongside terminal and editor tabs.
