using Protocol.Scp and getting error

Advertisement

dhiarmid.campbell@gmail.com
Joined:
Posts:
1
Location:
Cape Breton, Nova Scotia

using Protocol.Scp and getting error

Hi,
First, I'd like to say that this assembly is fantastic and very much appreciated. I was tasked with writing a small application that modifies weather product files (forecasts) and uploads them to an SFTP server. These files are then picked up by something called a continuous marine broadcast(CMB)/NAVTEX system and the file contents are sent to certain stations in a marine radio simulator. I went ahead and started writing the application after discovering the .NET WinSCP assembly. Everything went well. I installed a local SFTP server for testing (Solar Winds SFTP) and eventually had a working application doing exactly what I needed. I then found out that the workstations in the simulator (which are currently using WinSCP clients for transferring the files) are using SCP as the file protocol in WinSCP, not SFTP. Now I am not very well versed in the intricacies of SFTP/SCP/SSH but thought.. maybe I can just change the sessionOptions protocol to Protocol.Scp and set my solar winds SFTP server to SCP rather than SFTP and things may very well work in my development environment. Unfortunately, I am receiving exception "Server refused to start a shell/command." Even if I use the full blown WinSCP client I am receiving this error. In the simulator they are using a full blown WinSCP client also and are able to use SCP as the file protocol and put these files without issue. So would this issue have to do with my own Server setup? I have no issues at all when using Sftp as the protocol in my C# but I think I'll need to find a way to put these files using SCP if possible.

WinSCP log ends generally like this after exception:
. 2020-09-17 19:25:35.140 Using stored password.
. 2020-09-17 19:25:35.153 Sent password
. 2020-09-17 19:25:35.154 Detected network event
. 2020-09-17 19:25:35.154 Waiting for the server to continue with the initialization
. 2020-09-17 19:25:35.154 Access granted
. 2020-09-17 19:25:35.154 Opening main session channel
. 2020-09-17 19:25:35.154 Detected network event
. 2020-09-17 19:25:35.154 Waiting for the server to continue with the initialization
. 2020-09-17 19:25:35.154 Opened main channel
. 2020-09-17 19:25:35.155 Detected network event
. 2020-09-17 19:25:35.155 Waiting for the server to continue with the initialization
. 2020-09-17 19:25:35.155 Server refused to start a shell/command
. 2020-09-17 19:25:35.155 Attempt to close connection due to fatal exception:
* 2020-09-17 19:25:35.155 Server refused to start a shell/command
. 2020-09-17 19:25:35.155 Closing connection.
* 2020-09-17 19:25:35.176 (EFatal) Server refused to start a shell/command
Sorry if I rambled on, it's been a long day and this problem has had me all over the place. Any advice or help would be greatly appreciated.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,253
Location:
Prague, Czechia

Re: using Protocol.Scp and getting error

The SCP protocol is a very special thing. On its own, it supports file transfers only. But that's not enough for an application like WinSCP, which needs to be able to list files, and do other operations. So WinSCP is actually not a pure SCP client. It needs to use shell commands for some other operations. If your server support only pure SCP and not any *nix-like shell, WinSCP won't work. I do not know Solar Winds server, but most Windows "FTP" servers either do not support SCP at all, or do not support the features needed by WinSCP.
See https://winscp.net/eng/docs/requirements#scp and https://en.wikipedia.org/wiki/Secure_copy_protocol#Other_clients

Reply with quote

Advertisement

You can post new topics in this forum