Quantcast
Channel: SSH.NET Library
Viewing all 2955 articles
Browse latest View live

New Post: ssh.net uploading with progress bar

$
0
0
Thanks Sylwester. This was very helpful.

New Post: ssh.net uploading with progress bar

Commented Unassigned: Crash while handling SSH_MSG_CHANNEL_CLOSE message [2538]

$
0
0
The application crashed. Crash dump analysis indicate a possible race condition
at handling SSH_MSG_CHANNEL_CLOSE message.

2014-10-12 01:05:44,805 FATAL
System.NullReferenceException: Object reference not set to an instance of an object.
at Renci.SshNet.Sftp.SubsystemSession.RaiseError(Exception error)
at Renci.SshNet.Sftp.SubsystemSession.Session_ErrorOccured(Object sender, ExceptionEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at Renci.SshNet.Session.RaiseError(Exception exp)
at Renci.SshNet.Session.MessageListener()
at Renci.SshNet.Session.<Connect>b__17()
at Renci.SshNet.Session.<>c__DisplayClass3.<ExecuteThread>b__2(Object o)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Comments: ** Comment from web user: drieseng **

You should not get this error when using the latest beta release (or SSH.NET built from TFS/SVN).
Can you confirm that you're using an older version of SSH.NET ?

Are you able to reproduce this issue easily ?
If so, could you test again using the latest beta release (or SSH.NET built from TFS/SVN) ?

Commented Unassigned: An established connection was aborted by the server [2398]

$
0
0
When trying to download files from sftp, I am getting error:"__An established connection was aborted by the server__"
Comments: ** Comment from web user: drieseng **

I failed to reproduce this issue (with a 50 MB file).
What version of SSH.NET are you using ?
Could you try with the latest beta release (or SSH.NET built from TFS/SVN) ?

Commented Unassigned: Crash while handling SSH_MSG_CHANNEL_CLOSE message [2538]

$
0
0
The application crashed. Crash dump analysis indicate a possible race condition
at handling SSH_MSG_CHANNEL_CLOSE message.

2014-10-12 01:05:44,805 FATAL
System.NullReferenceException: Object reference not set to an instance of an object.
at Renci.SshNet.Sftp.SubsystemSession.RaiseError(Exception error)
at Renci.SshNet.Sftp.SubsystemSession.Session_ErrorOccured(Object sender, ExceptionEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at Renci.SshNet.Session.RaiseError(Exception exp)
at Renci.SshNet.Session.MessageListener()
at Renci.SshNet.Session.<Connect>b__17()
at Renci.SshNet.Session.<>c__DisplayClass3.<ExecuteThread>b__2(Object o)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Comments: ** Comment from web user: jk79 **

I was using version 2013.4.7.0. I don't think I can reproduce the error easily, as it happened in production environment.

New Post: ssh.net uploading with progress bar

$
0
0
thanks sly_tm

but ...

Error 1 Cannot convert lambda expression to type 'bool' because it is not a delegate type C:\Users\abedi98\Documents\Visual Studio 2010\Projects\sftp\Security SFTP Application\Security SFTP Application\Form1.cs 218 25 Security SFTP Application

Commented Issue: SftpClient ctor throws exception when hostname has _ character [1845]

$
0
0
The constructor for SftpClient and SshClient class throws an ArgumentException when the hostname has an underscrore character '_' . Using disassembly I can find the issue is the regex _rehost in Extensions.cs

This regex should be fixed as _ is valid hostname.
Comments: ** Comment from web user: drieseng **

I'd prefer to remove the host name validation altogether (except for a check to see whether the value is not null or empty).

I'll discuss this with Oleg.

Created Issue: Path is not always resolved to fully qualified path in SftpClient [2543]

$
0
0
Just noticed that there are several methods in SftpClient (eg. OpenRead) that do not resolve the specified path to a fully qualified path before passing the path on to other part of SSH.NET.

This results a SftpPathNotFoundException (no such file) when you use ChangeDirectory to change the working directory, and subsequently specify a path relative to this directory.

Edited Issue: Path is not always resolved to fully qualified path in SftpClient [2543]

$
0
0
Just noticed that there are several methods in SftpClient (eg. OpenRead) that do not resolve the specified path to a fully qualified path before passing the path on to other part of SSH.NET.

This results a SftpPathNotFoundException (no such file) when you use ChangeDirectory to change the working directory, and subsequently specify a path relative to this directory.

Commented Unassigned: Shell Stream incorrect output. [2190]

$
0
0
Hello. My code example:

```
SshClient client = new SshClient(host, user, password);

client.Connect();

using (ShellStream stream = client.CreateShellStream("xterm", 100, 100, 800, 600, 1024))
{
String line = String.Empty;

while (line != null)
{
Thread.Sleep(1000);

line = stream.ReadLine(TimeSpan.FromSeconds(5));

Console.WriteLine(line);
}
}

client.Disconnect();
```
__Case 1: missing /root/menu.sh file in my .bashrc script (Debian - russian locale).__

My program output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 17:58:22 2014 from 192.168.0.21

111111111
-bash: /root/menu.sh: Нет такого файла или каталога
или каталога
�лога
а
```

Putty output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 17:59:01 2014 from 192.168.0.21

111111111
-bash: /root/menu.sh: Нет такого файла или каталога
```

There are some strange strings in my program output:
```
или каталога
�лога
а
```

__Case 2: no /root/menu.sh file in my .bashrc script (Debian - russian locale).__

My program output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 18:09:51 2014 from 192.168.0.21

111111111
```

Putty output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 18:06:22 2014 from 192.168.0.21
111111111
```

All OK !!!

__Case 3: missing /root/menu.sh file in my .bashrc script (CentOs - default locale).__

My program output:

```
Last login: Mon Jun 23 18:16:06 2014 from 192.168.0.21
-bash: /root/menu.sh: No such file or directory
```

Putty output:

```
Last login: Mon Jun 23 18:15:01 2014 from 192.168.0.21
-bash: /root/menu.sh: No such file or directory
```

All OK !!!
Comments: ** Comment from web user: drieseng **

I tried to reproduce this issue (using locale ru_RU.utf8), but it worked just fine.
Is it possible for you to test using the latest beta release (or SSH.NET built from TFS/SVN) ?

Commented Unassigned: Getting File Not Found on all Upload/Delete/... cmds on my target file. [1699]

$
0
0
Downloaded SFTP app [ Renci.SshNet ] from "codeplex" .
Cannot get

sftp.BeginUploadFile( streamparm, targetfilepath)
or
sftp.UploadFile ( streamparm, targetfilepath, null )

to work.

Keep getting "File Not Found" error.

streamparm was created by :
System.IO.Stream streamparm = System.IO.OpenRead("c:\temp\test.csv");

I tried:
string targetfilepath = "sftp://sftp.dfs.com/sfd/test.csv";
string targetfilepath = "sftp.dfs.com/sfd/test.csv";
string targetfilepath = "sfd/test.csv";

sftp.ChangeDirectory("sfd");
string targetfilepath = "test.csv";

Tried using
string targetfilepath = "test.txt";

nothing works catching errors on save(data)

nothing works. Need help.

[ NOTE: sftp.ChangeDirectory("sfd"); . . . and . . . sftp.Create("sfd/test.csv"); . . . works ]
Comments: ** Comment from web user: drieseng **

What version of SSH.NET were you using ?
What's your home directory (SftpClient.WorkingDirectory) once you're connected ?

If "sfd" is a subdirectory of your home directory and "test.csv" is located in the "sfd" directory, then this should work just fine:

sftp.ChangeDirectory("sfd");
string targetfilepath = "test.csv";
sftp.UploadFile(streamparm, targetfilepath, null);

Closed Unassigned: lsnrctl: command not found issue [1874]

$
0
0
Hi,

I am facing issue while trying to run a command on a remote server using renci.dll
The error is as below

bash: lsnrctl: command not found

and command used as -

lsnrctl status | egrep -i 'security'

Whereas if i run the same command through ssh (i.e remotely connecting through putty) , I am able to get the command output.

thanks
Comments: Solution (or at least explanation) provided by gege21.

Closed Unassigned: Bash problemusing ssh.net Library [1591]

$
0
0
Hi, here is my code
```
ssh.Connect();
var cmd = ssh.CreateCommand("ls -all");
var asynch = cmd.BeginExecute(delegate(IAsyncResult ar)
{
Console.WriteLine(cmd.Result);
}, null);

var cmd1 = ssh.RunCommand("bash /etc/motor.sh"); // Perform long running task
var asynch1 = cmd1.BeginExecute(delegate(IAsyncResult ar)
{
Console.WriteLine(cmd1.Result);
}, null);

while (!(asynch.IsCompleted && asynch1.IsCompleted))
{
Console.WriteLine("Waiting for commands to complete...");
Thread.Sleep(2000);
}
cmd1.EndExecute(asynch1);
cmd.EndExecute(asynch);
ssh.Disconnect();

Console.ReadLine();
```
The problem is that command "ls -all" works well but any bash command doesn't work..
Any suggestions ?

Thank you :)
Comments: No feedback from reporter.

Commented Unassigned: Shell Stream incorrect output. [2190]

$
0
0
Hello. My code example:

```
SshClient client = new SshClient(host, user, password);

client.Connect();

using (ShellStream stream = client.CreateShellStream("xterm", 100, 100, 800, 600, 1024))
{
String line = String.Empty;

while (line != null)
{
Thread.Sleep(1000);

line = stream.ReadLine(TimeSpan.FromSeconds(5));

Console.WriteLine(line);
}
}

client.Disconnect();
```
__Case 1: missing /root/menu.sh file in my .bashrc script (Debian - russian locale).__

My program output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 17:58:22 2014 from 192.168.0.21

111111111
-bash: /root/menu.sh: Нет такого файла или каталога
или каталога
�лога
а
```

Putty output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 17:59:01 2014 from 192.168.0.21

111111111
-bash: /root/menu.sh: Нет такого файла или каталога
```

There are some strange strings in my program output:
```
или каталога
�лога
а
```

__Case 2: no /root/menu.sh file in my .bashrc script (Debian - russian locale).__

My program output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 18:09:51 2014 from 192.168.0.21

111111111
```

Putty output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 18:06:22 2014 from 192.168.0.21
111111111
```

All OK !!!

__Case 3: missing /root/menu.sh file in my .bashrc script (CentOs - default locale).__

My program output:

```
Last login: Mon Jun 23 18:16:06 2014 from 192.168.0.21
-bash: /root/menu.sh: No such file or directory
```

Putty output:

```
Last login: Mon Jun 23 18:15:01 2014 from 192.168.0.21
-bash: /root/menu.sh: No such file or directory
```

All OK !!!
Comments: ** Comment from web user: Melhior **

2014.4.6-beta1 binary from the home page download link.

Edited Issue: Shell Stream incorrect output. [2190]

$
0
0
Hello. My code example:

```
SshClient client = new SshClient(host, user, password);

client.Connect();

using (ShellStream stream = client.CreateShellStream("xterm", 100, 100, 800, 600, 1024))
{
String line = String.Empty;

while (line != null)
{
Thread.Sleep(1000);

line = stream.ReadLine(TimeSpan.FromSeconds(5));

Console.WriteLine(line);
}
}

client.Disconnect();
```
__Case 1: missing /root/menu.sh file in my .bashrc script (Debian - russian locale).__

My program output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 17:58:22 2014 from 192.168.0.21

111111111
-bash: /root/menu.sh: Нет такого файла или каталога
или каталога
�лога
а
```

Putty output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 17:59:01 2014 from 192.168.0.21

111111111
-bash: /root/menu.sh: Нет такого файла или каталога
```

There are some strange strings in my program output:
```
или каталога
�лога
а
```

__Case 2: no /root/menu.sh file in my .bashrc script (Debian - russian locale).__

My program output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 18:09:51 2014 from 192.168.0.21

111111111
```

Putty output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 18:06:22 2014 from 192.168.0.21
111111111
```

All OK !!!

__Case 3: missing /root/menu.sh file in my .bashrc script (CentOs - default locale).__

My program output:

```
Last login: Mon Jun 23 18:16:06 2014 from 192.168.0.21
-bash: /root/menu.sh: No such file or directory
```

Putty output:

```
Last login: Mon Jun 23 18:15:01 2014 from 192.168.0.21
-bash: /root/menu.sh: No such file or directory
```

All OK !!!
Comments: ** Comment from web user: drieseng **

OK, I managed to reproduce the problem.

The cause is obvious:
We hold the received data in a List<byte>, and search for CRLF.
We then remove index of CRLF + 2 bytes from the list.
This works fine for single-byte characters, but once you deal with multi-byte characters ...

This fix is very simple, but I want to add unit/regression tests for this before I commit my changes.
I'll update this issue once it's fixed in TFS.


Commented Unassigned: An established connection was aborted by the server [2398]

$
0
0
When trying to download files from sftp, I am getting error:"__An established connection was aborted by the server__"
Comments: ** Comment from web user: ashishkapoor2000 **

Hi Please find below stack trace

at Renci.SshNet.Sftp.SubsystemSession.WaitOnHandle(WaitHandle waitHandle, TimeSpan operationTimeout)
at Renci.SshNet.Sftp.SftpSession.RequestRead(Byte[] handle, UInt64 offset, UInt32 length)
at Renci.SshNet.Sftp.SftpFileStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at Maersk.AIS.BizTalk.CitiSFTP.Program.ReadSFTP(String strEnvironment) in d:\WorkingFolderNUser\Maersk.AIS.BizTalk\Maersk.AIS.BizTalk.Services\Maersk.AIS.BizTalk.CitiSFTP\Program.cs:line 117
at Maersk.AIS.BizTalk.CitiSFTP.Program.Main(String[] args) in d:\WorkingFolderNUser\Maersk.AIS.BizTalk\Maersk.AIS.BizTalk.Services\Maersk.AIS.BizTalk.CitiSFTP\Program.cs:line 20
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Source code checked in, #40610

$
0
0
Fix some R# warnings, and modify ReadLine to use use ordinal comparison for IndexOf.

Source code checked in, #40611

Source code checked in, #40614

$
0
0
Modify ShellStream.ReadLine() to take into account multi-byte character. Fixes issue #2190. Modify ShellStream.Write(string) to write nothing when text is null. Added unit tests.

Edited Issue: ShellStream.ReadLine produces incorrect output when reading multi-byte characters [2190]

$
0
0
Hello. My code example:

```
SshClient client = new SshClient(host, user, password);

client.Connect();

using (ShellStream stream = client.CreateShellStream("xterm", 100, 100, 800, 600, 1024))
{
String line = String.Empty;

while (line != null)
{
Thread.Sleep(1000);

line = stream.ReadLine(TimeSpan.FromSeconds(5));

Console.WriteLine(line);
}
}

client.Disconnect();
```
__Case 1: missing /root/menu.sh file in my .bashrc script (Debian - russian locale).__

My program output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 17:58:22 2014 from 192.168.0.21

111111111
-bash: /root/menu.sh: Нет такого файла или каталога
или каталога
�лога
а
```

Putty output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 17:59:01 2014 from 192.168.0.21

111111111
-bash: /root/menu.sh: Нет такого файла или каталога
```

There are some strange strings in my program output:
```
или каталога
�лога
а
```

__Case 2: no /root/menu.sh file in my .bashrc script (Debian - russian locale).__

My program output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 18:09:51 2014 from 192.168.0.21

111111111
```

Putty output:

```
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 23 18:06:22 2014 from 192.168.0.21
111111111
```

All OK !!!

__Case 3: missing /root/menu.sh file in my .bashrc script (CentOs - default locale).__

My program output:

```
Last login: Mon Jun 23 18:16:06 2014 from 192.168.0.21
-bash: /root/menu.sh: No such file or directory
```

Putty output:

```
Last login: Mon Jun 23 18:15:01 2014 from 192.168.0.21
-bash: /root/menu.sh: No such file or directory
```

All OK !!!
Comments: ** Comment from web user: drieseng **

Fixed in changeset 40614.

Viewing all 2955 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>