For OpenSSH SFTP on Windows Server 2022, the main configuration file path is:
%ProgramData%\ssh\sshd_config
ProgramData is a hidden folder, so the full default path is:
C:\ProgramData\ssh\sshd_config
To troubleshoot the SFTP issue:
- Open
C:\ProgramData\ssh\sshd_configwith an administrator account. - Validate the configuration by running:
sshd -t - Check that the file has no trailing spaces and that this entry is present:
Subsystem sftp sftp-server.exe - If SFTP users are expected to be restricted to a folder, verify that
ChrootDirectorypoints to a local directory, not a UNC path. - Check NTFS permissions on the chroot directory and user-writable folders. Use
icaclsfrom an elevated Command Prompt to verify and fix ACLs. - Review Event Viewer for related OpenSSH errors.
- After any change, restart the OpenSSH Server service.
If logs are needed, SFTP log data is stored in:
%ProgramData%\ssh\logs
To enable SFTP logging in sshd_config, set:
SyslogFacility LOCAL0
LogLevel DEBUG3
Subsystem sftp sftp-server.exe -f LOCAL0 -l DEBUG3
Then restart the service with:
NET STOP "OpenSSH SSH Server" && NET START "OpenSSH SSH Server"
If the service does not start or SFTP connections hang even after correcting the configuration and permissions, uninstall and reinstall OpenSSH Server.