mbuchok
mbuchok

Reputation: 409

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.

Upvotes: 2

Views: 991

Answers (2)

mbuchok
mbuchok

Reputation: 409

I opted to do the following:

  1. SSH into server through the desktop application
  2. Send an scp command to run a .net core console app on the server
  3. App on server performs ftp upload along with any other tasks I wanted to perform in the process.

Upvotes: 0

Martin Prikryl
Martin Prikryl

Reputation: 202088

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.

Upvotes: 1

Related Questions