This project is read-only.

SCP failing with DropBear

Jan 11, 2012 at 2:43 PM
Edited Jan 11, 2012 at 2:44 PM

Hi,

I've just started using SSH.NET after a lot of difficulty with sharpSSH. Thanks for the work.

I've been trying to SCP some files to an embedded device running Dropbear and have been seeing exceptions.

I'm just doing something like this  and getting socket exceptions

 

var scp = new ScpClient(remoteHost, login, password);
scp.Connect();
            
bool status = false;
try
{
  scp.Upload(new FileInfo(Source), Target);
  status = true;
} catch(Exception e)
{
  _logger.Warn("Exception in SCP transfer: " + e.Message);
}

 

I looked into this further and it seems to be to do with the Tx message size being too big for DropBear.

The default BufferSize for ScpClient looks to be 32kB. When I reduce this buffer size down to 8kB the file transfers ok.

Just in case anybody else sees this, add:

            scp.BufferSize = 8*1024;
            scp.Connect();

Cheers,

Alex Lennon

Dynamic Devices Ltd

Coordinator
Jan 11, 2012 at 2:51 PM

Hi,

 

Thanks for this update.

Unfortunately some embedded devices implement slightly different SSH server version so its close to impossible to cover all cases.

 

Thanks for this info, hopefully it will help someone in similar situation.

 

Thanks,

Oleg

Jan 11, 2012 at 2:53 PM

 

That's my hope :)

First impressions are that SSH.Net is significantly faster than the sharpSSH tooling I was using. Thanks again for the hard work

 

Alex

Feb 23, 2012 at 12:30 PM
Edited Feb 23, 2012 at 12:39 PM

@ajlennon

I had the same Problem. Not with dropbear, but with FileInfo.

Try to use FileInfo("").OpenRead().

Since fileinfo have strange behaviour and let your scp go to timeout... i guess its the best way to handle it!