It definitely sounds like the issue is related to the server setup rather than your C# code or the WinSCP assembly itself.
SFTP and SCP may both run over SSH, but they work very differently under the hood. SFTP uses a dedicated subsystem on the SSH server, while SCP requires the server to allow execution of remote shell commands. The error:
“Server refused to start a shell/command”
usually means the SSH server either does not support SCP at all or is configured to block shell access/command execution.
Since your SolarWinds server works fine with SFTP but fails with SCP even in the regular WinSCP client, that strongly suggests the server only supports SFTP functionality. Many lightweight or test SFTP servers do not implement full SCP support.
A few things you could check:
* Verify whether the server explicitly supports SCP (not just SSH/SFTP)
* Make sure shell access is enabled for the account
* Test against another SSH server like OpenSSH to confirm your client code works with SCP
* Check whether the simulator environment is using a full SSH server implementation rather than a dedicated SFTP-only server
Your WinSCP assembly code is probably fine if simply changing:
`Protocol = Protocol.Scp`
causes the issue only on your local test server.
In short: SCP requires the server to execute remote commands, and your current test server likely does not allow that.
SFTP and SCP may both run over SSH, but they work very differently under the hood. SFTP uses a dedicated subsystem on the SSH server, while SCP requires the server to allow execution of remote shell commands. The error:
“Server refused to start a shell/command”
usually means the SSH server either does not support SCP at all or is configured to block shell access/command execution.
Since your SolarWinds server works fine with SFTP but fails with SCP even in the regular WinSCP client, that strongly suggests the server only supports SFTP functionality. Many lightweight or test SFTP servers do not implement full SCP support.
A few things you could check:
* Verify whether the server explicitly supports SCP (not just SSH/SFTP)
* Make sure shell access is enabled for the account
* Test against another SSH server like OpenSSH to confirm your client code works with SCP
* Check whether the simulator environment is using a full SSH server implementation rather than a dedicated SFTP-only server
Your WinSCP assembly code is probably fine if simply changing:
`Protocol = Protocol.Scp`
causes the issue only on your local test server.
In short: SCP requires the server to execute remote commands, and your current test server likely does not allow that.