Search code examples
c#linuxsshsftpfile-transfer

C# SSH into Server A and SFTP upload to Server B (using SSH.NET)


I have a desktop application that's connecting to a Linux VPS via SSH that contains files that need to be uploaded to another server. Is this something I can do with SSH.NET or any other library? Or should I maybe go with the inefficient route of first downloading the files locally then initiating an SFTP connection to the server I need to upload to? Or maybe there's something completely different I should be doing - I'm open to suggestions.

Any direction would be appreciated.


Solution

  • There's nothing in SSH/SFTP that would help you implementing a file transfer between two remote servers. So SSH.NET library won't help you much with that either.

    All it can do for you, is to execute the same shell commands (sftp) on server A that you use manually to upload the files to B.