I use WinSCP desktop application on Windows server for a physical interface to upload files to a Linux server. I use SCP protocol, and in Advanced options I pass a SSH command ssh username@ipaddress
on connection to security server to tunnel to the server where I want to upload files. This allows me to upload files directly from Windows through the Linux security server to the end point Linux file server.
Source Windows Server -> Security Linux Server -> Destination Linux Server
Using C# I can successfully upload or send a command using this Session.ExecuteCommand
method/. However when I send the command ssh username@ipaddress
my script hangs there. I believe that the session context changes there and some asynchronous C# magic needs to happen.
I can can successfully send asynchronous SSH commands using this: https://csharp.hotexamples.com/examples/Renci.SshNet/SshClient/CreateCommand/php-sshclient-createcommand-method-examples.html#0x12a75b3c713031851a6d9f2c47732ffcab6bad015f554fa89ef604d333290d4a-28,,45,
I need the C# equivalent to be able to emulate my Desktop WinSCP application where I pass the SSH command ssh username@ipaddress
to freely upload from the source Windows server through a Linux Security Server to the remote Linux file server.
Can these examples be combined to create the C# code I need? A WinSCP session/SSH tunnel via Asynchronous Command. I am very familiar with the examples, please help!