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

Closed Unassigned: Scp slow copy [2801]

$
0
0
Hi,

I've been experimenting with the scp implementation and noticed it is slower compared to the command line tool scp. In my test, it is 5s to copy with scp, and 15s with SSH.NET. Is this expected? If not, what can I do to improve performance?

Thanks,
Manu
Comments: Moved issue to GitHub.

Closed Unassigned: Bug in SSH shell connection with Cisco IOS [2713]

$
0
0
Hi everyone! So I have compiled the project into a DLL and I am using that to connect to a Cisco server with SSH enabled. Everything works (I am able to issue commands, and the read back is correct), except when you try and issue the "enable" command. When you do this, SSH.net crashes.

For example, here is some sample code (vb.net) used to connect and repeat the issue:

```
Dim BufferSize as integer = 1024
Dim ssh_client As New SshClient("10.0.0.5", 22, "admin", "cisco")
ssh_client.Connect()
Dim shellstream As ShellStream = ssh_client.CreateShellStream("xterm", 80, 24, 800, 600, BufferSize)
Dim ssh_reader as New IO.BinaryReader(shellstream)
Dim ssh_writer as New IO.BinaryWriter(shellstream)
Do While shellstream.Length = 0
Thread.Sleep(100)
Loop
consoleout = ReadStreamText()
ssh_reader.Read(BufferIn, 0, BufferIn.Length) 'Reads back buffer with ascii "Cisco>"
Dim Data() as byte = System.Text.Encoding.ASCII.GetBytes("enable" & VbCrLf)
ssh_writer.Write(Data, 0, Data.Length)
ssh_writer.Flush()
```

After the data is sent, the readback buffer is the expected output ("Password:"), but immediately after that, the SSH.net crashes.

Error message: Specified argument was out of the range valid values
Location in SshData.cs:ReadBytes():line 153
The length variable is 29 and the data.count is 5.

After this crash, the shell connection is now unusable, you can not send data or read data from the buffers.

I would also note that this error only happens with the "enable" command. If I issue other commands, they all work and the output is correct. I have tried using SecureCRT and it works perfect as well, so I think there is some kind of bug that happens from data being sent back from the cisco server?

Any ideas?
Comments: Fixed as part of https://github.com/sshnet/SSH.NET/issues/66

Closed Unassigned: Sftpclient.Disconnect takes very long time [2738]

$
0
0
The following code takes over two minutes to execute. It gets stuck on Disconnect(). I am trying to connect to TITAN commercial FTP Server.


SftpClient client = new SftpClient(sAddress, iPort, sUserID, password);
client.Connect();
client.Disconnect();

I can connect to other SFTP sites just fine.

Any idea what would be wrong?

-Jayesh
Comments: This should improve considerably in the next version of SSH.NET.

If you're still seeing this issue in v2016.1.0 (beta1 or higher), then please submit an issue at our new home @GitHub.

Closed Unassigned: Null Exception thrown inside library [2721]

$
0
0
Below exception crashes the windows app. Any Ideas what is cause of the problem here.

Thanks.
```
Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
Stack:
at Renci.SshNet.Sftp.SubsystemSession.RaiseError(System.Exception)
at System.EventHandler`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Object, System.__Canon)
at Renci.SshNet.Session.RaiseError(System.Exception)
at Renci.SshNet.Session.MessageListener()
at Renci.SshNet.Session.<Connect>b__4()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()

```
Comments: You should no longer get this exception in version 2016.1.0 (beta1 or higher) of SSH.NET.

If you do, then please submit an issue at our new GitHub home.

Closed Unassigned: In some error cases, an unhandled exception might be thrown from a worker thread (uncatchable) [1840]

$
0
0
There is a race condition that can cause an unhandled exception to be thrown. Take a look at the following code:

```C#
try
{
// "server" needs to be changed to a real SSH server
// The credentials do not need to be valid
using (SftpClient client = new SftpClient("server", "user", "password"))
{
client.HostKeyReceived += delegate(object sender, HostKeyEventArgs e)
{
e.CanTrust = false;
};

client.Connect(); // <-- Exception from untrusted host key bubbles up here
} // <-- End of using block causes client.Dispose() to be called, causing an unhandled exception in another thread
}
catch (Exception ex)
{
// This code isn't executed because of the unhandled exception from another thread
Console.WriteLine("There was an error connecting to the server: {0}", ex.Message);
}
```

On my machine, this results in the following exception almost every time:

```
Renci.SshNet.Common.SshConnectionException was unhandled
HResult=-2146233088
Message=Client not connected.
Source=Renci.SshNet
StackTrace:
at Renci.SshNet.Session.SendMessage(Message message) in c:\temp\Test\Third Party\sshnet-31793\Renci.SshClient\Renci.SshNet\Session.cs:line 658
at Renci.SshNet.Session.SendDisconnect(DisconnectReason reasonCode, String message) in c:\temp\Test\Third Party\sshnet-31793\Renci.SshClient\Renci.SshNet\Session.cs:line 893
at Renci.SshNet.Session.RaiseError(Exception exp) in c:\temp\Test\Third Party\sshnet-31793\Renci.SshClient\Renci.SshNet\Session.cs:line 1914
at Renci.SshNet.Session.MessageListener() in c:\temp\Test\Third Party\sshnet-31793\Renci.SshClient\Renci.SshNet\Session.cs:line 1594
at Renci.SshNet.Session.<Connect>b__4() in c:\temp\Test\Third Party\sshnet-31793\Renci.SshClient\Renci.SshNet\Session.cs:line 529
at Renci.SshNet.Session.<>c__DisplayClass3d.<ExecuteThread>b__3c(Object o) in c:\temp\Test\Third Party\sshnet-31793\Renci.SshClient\Renci.SshNet\Session.NET40.cs:line 25
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
InnerException:

```

The problem is that `Session` is getting disposed (by the `using` statement) prior to `Session.SendDisconnect` being called from another thread while the client attempts to clean up from the exception thrown by the lack of trust in the host key.
Comments: If you can still reproduce this issue with version 2016.0.0 (or higher) of SSH.NET, then please submit an issue at our new [home](https://github.com/sshnet/SSH.NET).

Closed Unassigned: sftpClient and Exists method [2783]

$
0
0
I have wrote this simple test in MsTest:

[TestMethod]
public void TestExist()
{
// arrange
var filename = "filename.txt";
var file = new MemoryStream(this.GetBytes("This is a test"));

var cl = new SftpClient(configurator.Object.AppSettings["ftpServerURL"],
configurator.Object.GetIntValueFromAppSettings("ftpPortNumber"),
configurator.Object.AppSettings["ftpUsername"],
configurator.Object.AppSettings["ftpPassword"]);
cl.Connect();
cl.UploadFile(file, filename);

// act
var result = cl.Exists(filename);

// assert
Assert.AreEqual(true, result);
}

private byte[] GetBytes(string str)
{
byte[] bytes = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}

Though the file is correctly uploaded to the FTP the assertion is not verified. Why?
Comments: If you can still reproduce this issue with version 2016.0.0 (or higher) of SSH.NET, then please submit at our new [home](https://github.com/sshnet/SSH.NET).

Reviewed: 2016.0.0 (Sep 22, 2016)

$
0
0
Rated 5 Stars (out of 5) - Want for Monitoring

New Comment on "Documentation"

$
0
0
Right-click on the File SshNet.Help.chm Klick Properties On the Right -Accept to See all Contents.

New Post: Does SSH.NET use .NET System.Security.Cryptography classes or implement is own Crypto

$
0
0
Does SSH.NET library use .NET System.Security.Cryptography classes or implement its own Crypto classes ?

New Post: Does SSH.NET use .NET System.Security.Cryptography classes or implement is own Crypto

$
0
0
We implement our own hashing and crypto classes, but we intend to use the BCL (System.Security.Cryptography) classes for those target framework where they are available.

As of the 2016.0.0 release, we already do this for the hashing and MAC algorithms (SHA1, HMACSHA1, ...).

Please be aware that we've moved to GitHub.
Any new questions or issues you be submitted there.
Thanks!

Reviewed: 2016.0.0 (out 06, 2016)

$
0
0
Rated 5 Stars (out of 5) - verificand a versão

New Post: Disposing client without disconnecting

$
0
0
What is the best practice between these two examples? Does it make sense to put the Disconnect() in a finally block to ensure it is always called or is it acceptable to simply allow dispose to close the channel? I haven't found many examples on the best way to use this library. What is the correct way to handle exceptions after connecting to the SFTP server?
  • When the client is disposed it sends a command to close the channel and hides some internal exceptions.
  • Disconnect() closes the channel and then sends a command to disconnect.
Example 1:
using (var client= new SftpClient(connectionInfo))
{
    client.Connect();
    // There is a possibility that an exception could occur here.
    client.ListDirectory("");
    client.Disconnect();
}
Example 2:
using (var client= new SftpClient(connectionInfo))
{
    try
    {
        client.Connect();
        // There is a possibility that an exception could occur here.
        client.ListDirectory("");
    }
    catch(Exception exception)
    {
        // handle the exception
    }
    finally
    {
        client.Disconnect();
    }
}

Reviewed: 2016.0.0 (Oct 13, 2016)

$
0
0
Rated 5 Stars (out of 5) - I need this one for my project

Reviewed: 2016.0.0 (十一月 02, 2016)

$
0
0
Rated 5 Stars (out of 5) - test..........

New Post: stty:: Invalid command error reported as error while trying to run some commands remotely on a solaris system

$
0
0
Hi,

We use Renci SSH library to communicate with a solaris server. I observe that for any command it reports an error stty::Invalid command but the ExitStatus is always 0...meaning that command was successfully executed. Can you let us know how to avoid this issue with remote ssh execution.

Also at times few commands literally fail to execute because of this issue. Any quick support on this concern is appreciated.

Reviewed: 2016.0.0 (Thg11 11, 2016)

$
0
0
Rated 5 Stars (out of 5) - Very good tks :v

Reviewed: 2016.0.0 (Nov 14, 2016)

$
0
0
Rated 5 Stars (out of 5) - very good product

Reviewed: 2016.0.0 (十一月 16, 2016)

$
0
0
Rated 1 Stars (out of 5) - I can't download

Reviewed: 2016.0.0 (nov 21, 2016)

$
0
0
Rated 2 Stars (out of 5) - ertetyertert

Reviewed: 2016.0.0 (十一月 22, 2016)

$
0
0
Rated 5 Stars (out of 5) - I want to download
Viewing all 2955 articles
Browse latest View live


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