Welcome to Microsoft Q&A!
Thank you for taking the time to test the suggestions and share the screenshot.
Based on the error shown in the screenshot, the issue occurs because: Subsystem sftp sftp-server.exe
Is not a PowerShell command. It is a configuration entry that belongs in the OpenSSH server configuration file (sshd_config). When this line is executed directly in PowerShell, Windows returns the following error because it attempts to interpret Subsystem as a command: Subsystem : The term 'Subsystem' is not recognized...
For OpenSSH on Windows Server 2022, the default SSH server configuration file is located at:
C:\ProgramData\ssh\sshd_config
Note: The ProgramData folder is hidden by default. You may need to enable Show hidden items in File Explorer to browse to this location.
To verify the SFTP configuration, please follow these steps:
- Open Notepad or another text editor as Administrator.
- Open the file:
C:\ProgramData\ssh\sshd_config - Locate the SFTP subsystem entry. By default, it should appear similar to:
Subsystem sftp sftp-server.exe - Validate the OpenSSH configuration:
sshd -t - If no errors are reported, restart the OpenSSH service:
Restart-Service sshd
If sftp-server.exe cannot be found, please verify that the OpenSSH Server feature is installed:
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Server*'
The default OpenSSH installation location is: C:\Windows\System32\OpenSSH\
You can confirm that the SFTP executable exists by running: Get-ChildItem C:\Windows\System32\OpenSSH\sftp-server.exe
For additional troubleshooting, I recommend reviewing Event Viewer for any OpenSSH-related errors and validating the configuration after making any changes. Also, enabling OpenSSH logging can also help identify the root cause of SFTP connection failures.
For more information, please visit: OpenSSH Server Configuration for Windows | Microsoft Learn
Troubleshoot Common SFTP Issues - Windows Server | Microsoft Learn
Get started with OpenSSH Server for Windows | Microsoft Learn
If you find the information helpful, please consider clicking Accept Answer.
Thank you for using Microsoft Q&A.