How to Set Up a Windows SFTP Server
In this article
You can set up an SFTP server on Windows by enabling the OpenSSH Server feature built into Windows 10 and 11, then connecting with any SFTP client over SSH. SFTP (SSH File Transfer Protocol) runs over the same SSH service Windows already ships, so you do not need third-party server software, a separate daemon, or a paid license. The built-in OpenSSH Server gives you encrypted file transfer to and from your PC using your existing Windows accounts.
This guide covers enabling the feature, starting and securing the service, opening the firewall, and connecting from a client. Menu labels can differ slightly between Windows versions and editions, so if a name looks a little different, look for the closest match.
What You'll Need
- A PC running Windows 10 (version 1809 or later) or Windows 11, with administrator rights.
- An account on that PC that will be used for SFTP logins. A standard user account is safer than an administrator account for file transfers.
- Network access to the PC: same local network, or a router/VPN setup if you need access from outside.
- An SFTP client on the connecting device, such as WinSCP, FileZilla, or the built-in
sftpcommand on macOS and Linux. - Optional: a folder you want to expose for transfers, so you can point users at it instead of their whole profile.
Step-by-Step
- Open Optional Features. Press the Windows key, type optional features, and open Optional features in Settings. On Windows 11 you can also reach it through Settings > System > Optional features.
- Add the OpenSSH Server. Click Add a feature (or View features), search for OpenSSH Server, tick it, and click Install. Wait for the install to finish. Do not confuse it with OpenSSH Client, which is only for connecting out.
- Start the service. Press Windows key + R, type
services.msc, and press Enter. Find OpenSSH SSH Server, right-click it, and choose Start. - Make it start automatically. In the same Properties window, set Startup type to Automatic and click Apply. This keeps the server running after a reboot.
- Confirm it is listening. Open PowerShell and run
Get-Service sshd. The status should read Running. You can also runnetstat -an | findstr :22to confirm something is listening on port 22. - Allow it through the firewall. Open Windows Security > Firewall & network protection > Allow an app through firewall. If OpenSSH SSH Server is listed, tick the networks you need (Private is the safe default). If it is not listed, click Change settings > Allow another app and browse to
C:\Windows\System32\OpenSSH\sshd.exe. - Decide which account to use. Create or pick a standard Windows user for transfers. Avoid using your main administrator account for SFTP logins, because anyone who gets those credentials gets full control of the PC.
- Set up key-based login (recommended). On the client machine, generate a key pair with
ssh-keygen. Copy the public key into the server user'sC:\Users\<username>\.ssh\authorized_keysfile (create the.sshfolder if it does not exist). One key per line. This lets you log in without sending a password. - Tighten the server config. Open
C:\ProgramData\ssh\sshd_configin Notepad as administrator. Useful settings: setPasswordAuthentication noonce keys work, and considerPermitRootLogin no(it has no effect on Windows but keeps configs consistent). Save the file. - Restart the service. In
services.msc, right-click OpenSSH SSH Server and choose Restart so config changes take effect. - Connect from a client. In WinSCP or FileZilla, choose SFTP as the protocol, enter the PC's IP address or hostname, port 22, your Windows username, and either your password or your private key. Accept the host key fingerprint on first connection.
- Test read and write. Upload a small file to a test folder and download it again. If both work, the server is ready for real use.
Common Mistakes
Installing the client instead of the server. OpenSSH Client lets your PC connect out; OpenSSH Server lets others connect in. You need the Server feature.
Forgetting to start the service. Installing the feature does not always start it, and it may not be set to Automatic, so it silently stops after a reboot.
Leaving the firewall closed. The service can be running and still refuse connections because the firewall rule was never enabled.
Using an administrator account for transfers. This turns a file-transfer login into full remote control of the machine. Use a standard user.
Wrong key file permissions. On Windows, SSH can be picky about the authorized_keys file. If key login fails, check that the file is in the right user's .ssh folder and that the account owns it.
Editing sshd_config without restarting. Changes are only read when the service restarts.
Tips
Use a non-default port if the PC is reachable from the internet, and change it in both sshd_config and the firewall rule. Better still, do not expose port 22 directly at all: use a VPN or a router-level port forward only when you understand the risk.
Keep transfers inside a dedicated folder. Create something like C:\SFTP, give the transfer user modify rights on it, and point clients there. This limits the blast radius if credentials leak.
Log connections. Windows writes SSH events to Event Viewer under Applications and Services Logs > OpenSSH, which helps you see failed logins.
Keep Windows updated. Security fixes for the OpenSSH component arrive through normal Windows updates.
Troubleshooting
Connection refused. Check the service is running, then check the firewall rule. Confirm the client is using the right IP and port.
Connection times out. Usually a network issue: wrong IP, a different subnet, or a router blocking the port. Test from the same machine first using sftp localhost.
Password rejected. Confirm the Windows account name and password, and check whether the account is locked or disabled. If you disabled password login in the config, you must use a key.
Key login fails. Verify the public key is on a single line in authorized_keys, the file is in the correct user's folder, and the client is offering the matching private key.
Connected but cannot write. This is a folder permission problem, not an SSH problem. Grant the transfer user write access to the target folder.
Host key changed warning. If you reinstalled Windows or regenerated keys, the fingerprint changes. Only accept the new key if you know why it changed; otherwise stop and investigate.
Frequently Asked Questions
Is SFTP the same as FTP?
No. SFTP runs over SSH and is encrypted end to end. Plain FTP sends credentials and data in the clear and should not be used over untrusted networks.
Do I need extra software on Windows?
No. The OpenSSH Server optional feature provides SFTP. You only need a client on the device you connect from.
Can I use the built-in Windows account password?
Yes, while password authentication is enabled. Once key-based login works, turning passwords off is safer.
Which port does it use?
Port 22 by default. You can change it in sshd_config, but remember to update the firewall rule too.
Can I limit users to one folder?
The Windows OpenSSH build does not offer the same chroot options as Linux. The practical approach is a dedicated account plus folder permissions that only allow access to the folder you intend.
Should I open port 22 to the internet?
Only with care. Use strong keys, disable password login, and prefer a VPN. Exposed SSH services are scanned constantly.