A default SFTP login on Windows lands in the user's home folder - and from there, most of the C drive is browsable. ChrootDirectory turns the login into a jail: the user sees one folder and nothing above it.
Here is the fact the quick setup leaves out: an SFTP user is a real Windows user, and SSH gives that user a view of the file system that NTFS permissions allow - which is a lot. The fix is one block of configuration in C:\ProgramData\ssh\sshd_config: a Match section with ChrootDirectory. It takes five minutes and it is the single most valuable setting on a shared SFTP server.
Without a jail, a user who connects with FileZilla can click up from their home folder and browse C:\Users, C:\Program Files and any folder whose permissions allow reading - which on a typical Windows PC is most of them. They cannot change protected system files, but reading and downloading is more than enough damage. Folder permissions alone are a weak fence here; the jail removes the rest of the drive from view entirely.
OpenSSH is strict about the chroot folder, and the login simply fails if these rules are broken:
C:\SFTP\reports\upload, and give the user full control of that subfolder onlyThis surprises everyone the first time: the user uploads into the subfolder, not the jail root.
C:\ProgramData\ssh\sshd_config in Notepad as administratorMatch Group sftpusers and ChrootDirectory C:\SFTP\%u - %u expands to the usernameRestart-Service sshdThe ForceCommand internal-sftp line makes the account file-transfer-only. Even if someone has the password, they cannot open an interactive SSH shell or run commands on the PC - the connection serves files and nothing else. Combined with AllowTcpForwarding no, the account cannot be used as a tunnel into your network either. For pure file-exchange accounts, always add both lines.
See the complete SFTP server setup on screen, step by step, in the Technical Anshu video.
Watch Full VideoAlmost always the ownership rules: the chroot folder or a folder above it is writable by the user, or owned by the user. Make SYSTEM or Administrators the owner of the jail path, remove the user's write access on the jail folder itself, and give write access only to a subfolder inside it.
Yes. Use Match Group with ChrootDirectory C:\SFTP\%u - the %u token is replaced by each username, so every member of the group lands in their own folder under C:\SFTP.
Yes, the Windows port of OpenSSH supports ChrootDirectory with the same rules as on Linux, including the strict ownership requirements. The config file lives at C:\ProgramData\ssh\sshd_config.