Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#/Tamir.SharpSsh: System.IO.IOException: Pipe closed

Tags:

c#

ssh

I'm using Tamir.SharpSsh to upload a file to a ssh server with the code below but I'm getting System.IO.IOException: Pipe closed. Any clue why?

SshTransferProtocolBase scp = new Scp(SSH_HOST, SSH_USER);
scp.Password = SSH_PASSWORD;
scp.Connect();
foreach (string file in files)
{
    string remotePath = "incoming/" + new FileInfo(file).Name;
    scp.Put(file, remotePath);
}
scp.Close();

Regards /Niels

like image 466
Niels Bosma Avatar asked Feb 28 '23 10:02

Niels Bosma


2 Answers

For future references: Apparently the server only accepted Sftp connections. So I changed to:

SshTransferProtocolBase scp = new Sftp(SSH_HOST, SSH_USER);
like image 114
Niels Bosma Avatar answered Mar 08 '23 01:03

Niels Bosma


I had exactly the same problem ("Pipe Closed") when trying to transfer files.
Changing to

Sftp scp = new Sftp(SSH_HOST, SSH_USER);

solved the problem.
Thanks
Stefano

like image 45
Stefano Avatar answered Mar 08 '23 00:03

Stefano