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

Commented Unassigned: Unable to connect to : Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication." [1871]

$
0
0
Hello,

After doing Import-Module SSH-Sessions, I try to connect as follows:

PS C:> New-SshSession -ComputerName 10.220.12.220 -Username username -Password ***********
Unable to connect to 10.220.12.220: Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication."

I can to it connect using putty. The putty log shows me this (hoe this helps):

2014-01-16 06:53:21 Looking up host "10.220.12.220"
2014-01-16 06:53:21 Connecting to 10.220.12.220 port 22
2014-01-16 06:53:21 Server version: SSH-2.0-OpenSSH_4.2
2014-01-16 06:53:21 Using SSH protocol version 2
2014-01-16 06:53:21 We claim version: SSH-2.0-PuTTY_Snapshot_2010_05_02:r8934
2014-01-16 06:53:21 Doing Diffie-Hellman group exchange
2014-01-16 06:53:21 Doing Diffie-Hellman key exchange with hash SHA-1
2014-01-16 06:53:23 Host key fingerprint is:
2014-01-16 06:53:23 ssh-rsa 2048 <some hex string>
2014-01-16 06:53:23 Initialised AES-256 CBC client->server encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 client->server MAC algorithm
2014-01-16 06:53:23 Initialised AES-256 CBC server->client encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 server->client MAC algorithm
2014-01-16 06:53:40 Access granted
2014-01-16 06:53:40 Opened channel for session
2014-01-16 06:53:40 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2014-01-16 06:53:40 Started a shell/command
Comments: ** Comment from web user: DarthMaul40 **

Hello and thanks for the answer!

I just tried and the result is the same.


New Post: ssh.net uploading with progress bar

Commented Unassigned: Unable to connect to : Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication." [1871]

$
0
0
Hello,

After doing Import-Module SSH-Sessions, I try to connect as follows:

PS C:> New-SshSession -ComputerName 10.220.12.220 -Username username -Password ***********
Unable to connect to 10.220.12.220: Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication."

I can to it connect using putty. The putty log shows me this (hoe this helps):

2014-01-16 06:53:21 Looking up host "10.220.12.220"
2014-01-16 06:53:21 Connecting to 10.220.12.220 port 22
2014-01-16 06:53:21 Server version: SSH-2.0-OpenSSH_4.2
2014-01-16 06:53:21 Using SSH protocol version 2
2014-01-16 06:53:21 We claim version: SSH-2.0-PuTTY_Snapshot_2010_05_02:r8934
2014-01-16 06:53:21 Doing Diffie-Hellman group exchange
2014-01-16 06:53:21 Doing Diffie-Hellman key exchange with hash SHA-1
2014-01-16 06:53:23 Host key fingerprint is:
2014-01-16 06:53:23 ssh-rsa 2048 <some hex string>
2014-01-16 06:53:23 Initialised AES-256 CBC client->server encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 client->server MAC algorithm
2014-01-16 06:53:23 Initialised AES-256 CBC server->client encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 server->client MAC algorithm
2014-01-16 06:53:40 Access granted
2014-01-16 06:53:40 Opened channel for session
2014-01-16 06:53:40 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2014-01-16 06:53:40 Started a shell/command
Comments: ** Comment from web user: drieseng **

Did you try with the latest beta ? (which is dated, I know)

Commented Issue: Server string is null or empty Issue [2223]

$
0
0
can you help me understand why Session.cs is throwing an InvalidOperationException of "Server string is null or empty." when it is attempting to read the response(s) coming back from the connection attempt?
It seems this exception will always be thrown if the first line in the response is NULL or empty.
Which is happening to me.

If I remove this thrown exception and allow the full timeout on the ConnectionInfo to expire, my connection is eventually made and the server version is returned in the response.
Comments: ** Comment from web user: benhull **

it seems to be corrected.
I will continue testing on other sFTP servers with different message lengths and configurations.

Commented Unassigned: Unable to connect to : Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication." [1871]

$
0
0
Hello,

After doing Import-Module SSH-Sessions, I try to connect as follows:

PS C:> New-SshSession -ComputerName 10.220.12.220 -Username username -Password ***********
Unable to connect to 10.220.12.220: Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication."

I can to it connect using putty. The putty log shows me this (hoe this helps):

2014-01-16 06:53:21 Looking up host "10.220.12.220"
2014-01-16 06:53:21 Connecting to 10.220.12.220 port 22
2014-01-16 06:53:21 Server version: SSH-2.0-OpenSSH_4.2
2014-01-16 06:53:21 Using SSH protocol version 2
2014-01-16 06:53:21 We claim version: SSH-2.0-PuTTY_Snapshot_2010_05_02:r8934
2014-01-16 06:53:21 Doing Diffie-Hellman group exchange
2014-01-16 06:53:21 Doing Diffie-Hellman key exchange with hash SHA-1
2014-01-16 06:53:23 Host key fingerprint is:
2014-01-16 06:53:23 ssh-rsa 2048 <some hex string>
2014-01-16 06:53:23 Initialised AES-256 CBC client->server encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 client->server MAC algorithm
2014-01-16 06:53:23 Initialised AES-256 CBC server->client encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 server->client MAC algorithm
2014-01-16 06:53:40 Access granted
2014-01-16 06:53:40 Opened channel for session
2014-01-16 06:53:40 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2014-01-16 06:53:40 Started a shell/command
Comments: ** Comment from web user: DarthMaul40 **

Hello,

I loaded the wrong dll, sorry for that. However, I have another error now:

Unable to connect to 10.220.12.220: Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication (publickey,keyboard-interactive)."

Commented Unassigned: Unable to connect to : Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication." [1871]

$
0
0
Hello,

After doing Import-Module SSH-Sessions, I try to connect as follows:

PS C:> New-SshSession -ComputerName 10.220.12.220 -Username username -Password ***********
Unable to connect to 10.220.12.220: Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication."

I can to it connect using putty. The putty log shows me this (hoe this helps):

2014-01-16 06:53:21 Looking up host "10.220.12.220"
2014-01-16 06:53:21 Connecting to 10.220.12.220 port 22
2014-01-16 06:53:21 Server version: SSH-2.0-OpenSSH_4.2
2014-01-16 06:53:21 Using SSH protocol version 2
2014-01-16 06:53:21 We claim version: SSH-2.0-PuTTY_Snapshot_2010_05_02:r8934
2014-01-16 06:53:21 Doing Diffie-Hellman group exchange
2014-01-16 06:53:21 Doing Diffie-Hellman key exchange with hash SHA-1
2014-01-16 06:53:23 Host key fingerprint is:
2014-01-16 06:53:23 ssh-rsa 2048 <some hex string>
2014-01-16 06:53:23 Initialised AES-256 CBC client->server encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 client->server MAC algorithm
2014-01-16 06:53:23 Initialised AES-256 CBC server->client encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 server->client MAC algorithm
2014-01-16 06:53:40 Access granted
2014-01-16 06:53:40 Opened channel for session
2014-01-16 06:53:40 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2014-01-16 06:53:40 Started a shell/command
Comments: ** Comment from web user: drieseng **

I'm glad the new error is more clear.
The SSH server you're connecting to only support publickey and keyboard-interactive authentication methods (and not password).
The powershell module does not support the keyboard-interactive method, so I'd recommend using publickey authentication.

Let me know if you need more help,
Gert

Commented Unassigned: [Retracted] Random Exception on multi-handle wait [1757]

$
0
0
I use renci.sshnet in a multi-threaded/multi-concurrent-connection environment and was observing randome generic exceptions being thrown during heavy testing.

> Using Revision: 28765

The problem was found in Session.cs lines 637 through 646:
```
switch (EventWaitHandle.WaitAny(waitHandles, this.ConnectionInfo.Timeout))
{
// case 0:
// throw this._exception;
case System.Threading.WaitHandle.WaitTimeout:
this.SendDisconnect(DisconnectReason.ByApplication, "Operation timeout");
throw new SshOperationTimeoutException("Session operation has timed out");
default:
break;
}
```
With lines 639 and 670, here commented out, the random general exception was no longer thrown. Upon inspection it was found that the __WaitAny()__ call returns a zero base index to the event handle, in the passed in array of handles, that caused the wait to release. Thus, zero is a valid return value implying wait success. It should not have thrown an exception.
Comments: ** Comment from web user: JohnRo **

Since we applied the set of proposed fixes to our copy of the pre-beta code base (see below) the solution has been stable for us and we have not needed to freshen the code. We are in an "if it isn't broken, don't fix it" mode and do not expect to upgrade the code to the latest beta (apologies).

https://sshnet.codeplex.com/workitem/1756
https://sshnet.codeplex.com/workitem/1758
https://sshnet.codeplex.com/workitem/1759
https://sshnet.codeplex.com/workitem/1760

Closed Unassigned: [Retracted] Random Exception on multi-handle wait [1757]

$
0
0
I use renci.sshnet in a multi-threaded/multi-concurrent-connection environment and was observing randome generic exceptions being thrown during heavy testing.

> Using Revision: 28765

The problem was found in Session.cs lines 637 through 646:
```
switch (EventWaitHandle.WaitAny(waitHandles, this.ConnectionInfo.Timeout))
{
// case 0:
// throw this._exception;
case System.Threading.WaitHandle.WaitTimeout:
this.SendDisconnect(DisconnectReason.ByApplication, "Operation timeout");
throw new SshOperationTimeoutException("Session operation has timed out");
default:
break;
}
```
With lines 639 and 670, here commented out, the random general exception was no longer thrown. Upon inspection it was found that the __WaitAny()__ call returns a zero base index to the event handle, in the passed in array of handles, that caused the wait to release. Thus, zero is a valid return value implying wait success. It should not have thrown an exception.
Comments: Reporter cannot upgrade to latest version to see if issue is fixed.

Commented Unassigned: [Proposed Fix] Timeout waiting for KeyExchange with multi-threaded connections [1756]

$
0
0
I use renci.sshnet in a multi-threaded/multi-concurrent-connections environment. Some connections were experiencing a timeout during the connection initiation, causing the connection to fail. The timeout was occuring during the KeyExchange.

(Using Revision 28765)
Inspecting the code in the area of the timeout showed that a lock on the session object was being applied in Session.cs lines 438 through 581. Within these lines is a call to
```
WaitHandle(this._keyExchangeCompletedWaitHandle); //on line 538
```
The above timesout occurs because of the deadlock condition from the WaitHandle call that releases the thread of execution while holding a lock on the session object. The key exchange process' normal and subsequent call from within any of the various Security\KeyExchange_xxx_.cs modules
```
this.Session.MessageReceived += Session_MessageReceived; // cannot complete because of the lock in Session Connect
```
is blocked from completing until the WaitHandle eventually times out. But, by this time, the KeyExchange negotiation is over and failed and so the conneciton also fails.

The remedy that has been tested is to remove the end of scope of the lock (the close curly brace '}') from line 581 to line 536. This removes the deadlock and allows the key exchange to negotiate without blocking.
Comments: ** Comment from web user: drieseng **

I don't see how the lock on a session instance in Session.Connect would cause a deadlock when attempting to subscribe on an event of that same session instance.

The lock on a session instance does not prevent concurrent access to members of that instance.

Closed Unassigned: [Proposed Fix] Timeout waiting for KeyExchange with multi-threaded connections [1756]

$
0
0
I use renci.sshnet in a multi-threaded/multi-concurrent-connections environment. Some connections were experiencing a timeout during the connection initiation, causing the connection to fail. The timeout was occuring during the KeyExchange.

(Using Revision 28765)
Inspecting the code in the area of the timeout showed that a lock on the session object was being applied in Session.cs lines 438 through 581. Within these lines is a call to
```
WaitHandle(this._keyExchangeCompletedWaitHandle); //on line 538
```
The above timesout occurs because of the deadlock condition from the WaitHandle call that releases the thread of execution while holding a lock on the session object. The key exchange process' normal and subsequent call from within any of the various Security\KeyExchange_xxx_.cs modules
```
this.Session.MessageReceived += Session_MessageReceived; // cannot complete because of the lock in Session Connect
```
is blocked from completing until the WaitHandle eventually times out. But, by this time, the KeyExchange negotiation is over and failed and so the conneciton also fails.

The remedy that has been tested is to remove the end of scope of the lock (the close curly brace '}') from line 581 to line 536. This removes the deadlock and allows the key exchange to negotiate without blocking.
Comments: As mentioned in issue 1757:
Reporter cannot upgrade to latest version to see if issue is fixed.

Commented Unassigned: [Proposed Fix] Chasing a serious Event Handle leak,... Part I [1758]

$
0
0
I use renci.sshnet in a multi-threaded/multi-concurrent-connections environment. Under heavy testing we were seeing a leakage of around 1,500 event handles a minute. Under normal use, the leak was still eveident; with heavy use causing the system to run out of resources and crash after weeks of continuous operations.

Initially it was puzzling why the dispose was not being called on several of the classes creating event handles for synchronization. With the hope of clarity I will divide the proposed code changes out, file by file, discussing only the fix rational relevant to the file being discussed:
> Using Revision 28765 - BaseClient.cs

At first I thought this change was significant because we were taking the approach of explicity calling the __Dispose()__ method as objects went out of scope. This turned out to not be the main cause of the handle leak, and most of our changes to explicitly call the __Dispose()__ method were retracted. Though an optional and minor change, I left this one in because the session object's life span is longer, warrenting an explicit call to __Dispose()__. Please consider the following code block (lines 93 through 120):
```
public BaseClient(ConnectionInfo connectionInfo)
{
if (connectionInfo == null)
throw new ArgumentNullException("connectionInfo");

this.ConnectionInfo = connectionInfo;
this.Session = new Session(connectionInfo);
//! The above session object is immediately replaced upon Connect()
}

/// <summary>
/// Connects client to the server.
/// </summary>
public void Connect()
{
this.OnConnecting();

if (this.IsConnected)
{
this.Session.Disconnect();
}

//! Session object created in the constructor is abandoned
//! Cleanup session resources prior to replacement.
if (this.Session != null)
this.Session.Dispose();

this.Session = new Session(this.ConnectionInfo);
this.Session.HostKeyReceived += Session_HostKeyReceived;
this.Session.ErrorOccured += Session_ErrorOccured;
this.Session.Connect();

this.OnConnected();
}

```
Note, the more agressive fix would be to either keep the session object instantiated from the constructor or wait to instantiate the session object from the __Connect()__ method. I chose another option to simply call the __Session.Dispose()__ method prior to the Session object's replacement in order to return system resources more quickly. This is the only benefit, as it was found that the event handle leak was not related to this double construction.
Comments: ** Comment from web user: drieseng **

Most, if not all, event handler leaks should be fixed now.

I agree that we should dispose the previous (broken) session, before creating a new session.
I added the following TODO to our Session class:

// TODO (see issue #1758):
// we're not stopping the keep-alive timer and disposing the session here
//
// we could do this but there would still be side effects as concrete
// implementations may still hang on to the original session
//
// therefore it would be better to actually invoke the Disconnect method
// (and then the Dispose on the session) but even that would have side effects
// eg. it would remove all forwarded ports from SshClient
//
// I think we should modify our concrete clients to better deal with a
// disconnect. In case of SshClient this would mean not removing the
// forwarded ports on disconnect (but only on dispose ?) and link a
// forwarded port with a client instead of with a session
//
// To be discussed with Oleg (or whoever is interested)

As mentioned, I'd like to have a discussion on this change first.

Commented Unassigned: Unable to connect to : Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication." [1871]

$
0
0
Hello,

After doing Import-Module SSH-Sessions, I try to connect as follows:

PS C:> New-SshSession -ComputerName 10.220.12.220 -Username username -Password ***********
Unable to connect to 10.220.12.220: Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication."

I can to it connect using putty. The putty log shows me this (hoe this helps):

2014-01-16 06:53:21 Looking up host "10.220.12.220"
2014-01-16 06:53:21 Connecting to 10.220.12.220 port 22
2014-01-16 06:53:21 Server version: SSH-2.0-OpenSSH_4.2
2014-01-16 06:53:21 Using SSH protocol version 2
2014-01-16 06:53:21 We claim version: SSH-2.0-PuTTY_Snapshot_2010_05_02:r8934
2014-01-16 06:53:21 Doing Diffie-Hellman group exchange
2014-01-16 06:53:21 Doing Diffie-Hellman key exchange with hash SHA-1
2014-01-16 06:53:23 Host key fingerprint is:
2014-01-16 06:53:23 ssh-rsa 2048 <some hex string>
2014-01-16 06:53:23 Initialised AES-256 CBC client->server encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 client->server MAC algorithm
2014-01-16 06:53:23 Initialised AES-256 CBC server->client encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 server->client MAC algorithm
2014-01-16 06:53:40 Access granted
2014-01-16 06:53:40 Opened channel for session
2014-01-16 06:53:40 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2014-01-16 06:53:40 Started a shell/command
Comments: ** Comment from web user: DarthMaul40 **

Hello,

That's quite bad news to me, as I wanted to use this library against multiple targets (around 1000 hosts). Is publickey authentication doable in my case? I don't have much experience with public keys, but I have the feeling that every host has to be setup to use that public key, isn't? Could you give me some ideas on this?

Thanks a lot!

Source code checked in, #40574

$
0
0
Fix unsubscribe from channel events.

Closed Unassigned: [Proposed Fix] Chasing a serious Event Handle leak,... Part II [1759]

$
0
0
I use renci.sshnet in a multi-threaded/multi-concurrent-connections environment. Under heavy testing we were seeing a leakage of around 1,500 event handles a minute. Under normal use, the leak was still evident; with heavy use causing the system to run out of resources and crash after weeks of continuous operations.

Initially it was puzzling why the dispose was not being called on several of the classes creating event handles for synchronization. With the hope of clarity I will divide the proposed code changes out, file by file, discussing only the fix rational relevant to the file being discussed:
> Using Revision 28765 - SshCommand.cs

The crux of the event handle leakage was caused by circular references between the various Session, Channel and Command objects. In a loose organization, the Session object contained the Channel objects and the Channel objects contained the Command objects. The circular references arose from the Channel and Command objects placing eventhandler callbacks onto the session object as well as the Command object registering eventhandlers on the Channel object. Even though the channel and command objects were no longer referenced from any explicit code scope,... the eventhandler registration on the Session and Channle objects kept them from being garbage collected. Likewise, the channel and command object's back references to the Session object kept the Session object from being garbage collected. No garbage collection, no dispose,... no dispose, no freeing of the event handles.

In the original code, the eventhandlers were removed from the Session object in the Channel and Command destructors,... which are never called from the garbage collector because of the circular references. Once the eventhandlers were removed from the Session object earlier in the life cycle of the Channel and Command objects, the garbage collector began calling the Channel and Command destructors, which called their respective __Dispose()__ methods to cleanup system resources.

Starting on line 144, remove the two eventhandler registrations to the Session object from the constructor:
```
internal SshCommand(Session session, string commandText)
{
if (session == null)
throw new ArgumentNullException("session");

if (commandText == null)
throw new ArgumentNullException("commandText");

this._session = session;
this.CommandText = commandText;
this.CommandTimeout = new TimeSpan(0, 0, 0, 0, -1);

//! -- Shorten the eventhandling window by moving these to the BeginExecute() function --
//! this._session.Disconnected += Session_Disconnected;
//! this._session.ErrorOccured += Session_ErrorOccured;
}
```

Instead of keeping the eventhandlers registered through the entire object's life, only keep them registered within the __Begin/EndExecute()__ operating window; starting on Line 215:
```
public IAsyncResult BeginExecute(AsyncCallback callback, object state)
{
this._session.Disconnected += Session_Disconnected;
this._session.ErrorOccured += Session_ErrorOccured;
```

A little more went into the companion __EndExecute()__ method than just unregistering the eventhandlers. First we wrapped the function code in a __try/finally__ block. The eventhandler unregistration is placed into the __finally__ section. Next we moved the _this.channel = null_ out of the __EndExecute()__ function as we found that the member was being used outside of the __Begin/EndExecute()__ scope. The explicit call to the __Dispose()__ on the _asyncResult_ object prior to it being dismissed (or set equal to null) was left in from a failed fix attempt because it still has the value of returning unused system resources ahead of garbage collection. And lastly, we added, to the __finally__ section the deregistration of Command object eventhandlers from the Channel object.
```
public string EndExecute(IAsyncResult asyncResult)
{
try
{
if (this._asyncResult == asyncResult && this._asyncResult != null)
{
lock (this._endExecuteLock)
{
if (this._asyncResult != null)
{
// Make sure that operation completed if not wait for it to finish
this.WaitHandle(this._asyncResult.AsyncWaitHandle);

if (this._channel.IsOpen)
{
this._channel.SendEof();
this._channel.Close();
}

this._asyncResult.AsyncWaitHandle.Dispose();
this._asyncResult = null;

return this.Result;
}
}
}
}
finally
{
if (this._channel != null)
{
this._channel.DataReceived -= Channel_DataReceived;
this._channel.ExtendedDataReceived -= Channel_ExtendedDataReceived;
this._channel.RequestReceived -= Channel_RequestReceived;
this._channel.Closed -= Channel_Closed;
}

this._session.Disconnected -= Session_Disconnected;
this._session.ErrorOccured -= Session_ErrorOccured;
}

throw new ArgumentException("Either the IAsyncResult object did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.");
}
```

> _more for this file in Part III_
Comments: I think we took care of most the issues you mentioned.

I did not move the session event subscription to BeginExecute.
Leaving it in the ctor allows us to pass more meaningful information as to the cause of a disconnect in the near future. Moving it to BeginExecute would mean you can only throw an exception saying the session has disconnected.

I may still change my mind on this though.

Thanks a lot for diving into this!

Commented Unassigned: Unable to connect to : Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication." [1871]

$
0
0
Hello,

After doing Import-Module SSH-Sessions, I try to connect as follows:

PS C:> New-SshSession -ComputerName 10.220.12.220 -Username username -Password ***********
Unable to connect to 10.220.12.220: Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication."

I can to it connect using putty. The putty log shows me this (hoe this helps):

2014-01-16 06:53:21 Looking up host "10.220.12.220"
2014-01-16 06:53:21 Connecting to 10.220.12.220 port 22
2014-01-16 06:53:21 Server version: SSH-2.0-OpenSSH_4.2
2014-01-16 06:53:21 Using SSH protocol version 2
2014-01-16 06:53:21 We claim version: SSH-2.0-PuTTY_Snapshot_2010_05_02:r8934
2014-01-16 06:53:21 Doing Diffie-Hellman group exchange
2014-01-16 06:53:21 Doing Diffie-Hellman key exchange with hash SHA-1
2014-01-16 06:53:23 Host key fingerprint is:
2014-01-16 06:53:23 ssh-rsa 2048 <some hex string>
2014-01-16 06:53:23 Initialised AES-256 CBC client->server encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 client->server MAC algorithm
2014-01-16 06:53:23 Initialised AES-256 CBC server->client encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 server->client MAC algorithm
2014-01-16 06:53:40 Access granted
2014-01-16 06:53:40 Opened channel for session
2014-01-16 06:53:40 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2014-01-16 06:53:40 Started a shell/command
Comments: ** Comment from web user: drieseng **

The problem isn't in this library.
We do support password, public key and keyboard-interactive authentication.
It's just that the powershell module - which was not implemented by us - does not support keyboard-interactive authentication, and the SSH servers you're connecting to do not support the password authentication method.

That leaves you with a few options:
1. Use publickey authentication. For this you indeed need to first copy your public key to the authorized_keys file for the user account you're using to all your servers
2. Enable the password authentication method on all your servers.
3. Contact the author of the powershell module to support the keyboard-interactive authentication.
4. Do not use the powershell module, but use SSH.NET directly. This allows you to use keyboard-interactive authentication.

Hope this helps,
Gert


Closed Unassigned: System.ArgumentOutOfRangeException on Disconnect() [2389]

$
0
0
Version: __2013.4.7.0__

Hey everybody,

I am sporadically getting the following exception while trying to disconnect SftpClient.

__System.ArgumentOutOfRangeException__: Specified argument was out of the range of valid values.
Parameter name: length
at Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle)
at Renci.SshNet.Channels.Channel.Close(Boolean wait)
at Renci.SshNet.Channels.ChannelSession.Close(Boolean wait)
at Renci.SshNet.Channels.Channel.Close()
at Renci.SshNet.Sftp.SubsystemSession.Disconnect()
at Renci.SshNet.SftpClient.OnDisconnecting()
at Renci.SshNet.BaseClient.__Disconnect()__

Code Snippet:
```
if (sftpClient.IsConnected)
sftpClient.Disconnect();
```

Any idea why ?
Comments: The reporter of this issue will upgrade to the latest version and reopen the issue if necessary.

Commented Unassigned: [Proposed Fix] Timeout waiting for KeyExchange with multi-threaded connections [1756]

$
0
0
I use renci.sshnet in a multi-threaded/multi-concurrent-connections environment. Some connections were experiencing a timeout during the connection initiation, causing the connection to fail. The timeout was occuring during the KeyExchange.

(Using Revision 28765)
Inspecting the code in the area of the timeout showed that a lock on the session object was being applied in Session.cs lines 438 through 581. Within these lines is a call to
```
WaitHandle(this._keyExchangeCompletedWaitHandle); //on line 538
```
The above timesout occurs because of the deadlock condition from the WaitHandle call that releases the thread of execution while holding a lock on the session object. The key exchange process' normal and subsequent call from within any of the various Security\KeyExchange_xxx_.cs modules
```
this.Session.MessageReceived += Session_MessageReceived; // cannot complete because of the lock in Session Connect
```
is blocked from completing until the WaitHandle eventually times out. But, by this time, the KeyExchange negotiation is over and failed and so the conneciton also fails.

The remedy that has been tested is to remove the end of scope of the lock (the close curly brace '}') from line 581 to line 536. This removes the deadlock and allows the key exchange to negotiate without blocking.
Comments: ** Comment from web user: JohnRo **

Thanks for looking into this and the other proposed fixes,... If we do revisit and freshen our code, I will run the latest through our tests again to verify your fixes.

New Post: How to detect a keyboard interactive command request.

$
0
0
Hi,

i have the same problem! have you found a solution?

regards
Thomas

Created 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()

New Post: ssh.net uploading with progress bar

$
0
0
Thanks for contacting me. I hope you realise I am not an author of this library, though.
Your question is a bit off topic, progress bar is a UI control, nothing to do with Sftp.
Anyway, here's how you can get the upload progress, which you can then use with progress bar if you need to.

NOTE: Because of the way progress callback is currently implemented, your progress bar is likely to be jumping back and forth during upload.

You should be able to do something like this:
            using( Renci.SshNet.SftpClient sftp = new Renci.SshNet.SftpClient( "some.host", "some.file", "some.password" ) )
            {
                using( Stream fin = File.OpenRead( "file.in" ) )
                {
                    try
                    {
                        sftp.ConnectionInfo.Timeout = new TimeSpan( 0, 0, 30 );

                        sftp.Connect();

                        long total = fin.Length > 0 ? fin.Length : 1;
                        sftp.UploadFile(
                            fin,
                            "/upload/" + "salam.txt",
                            bytesUploaded =>
                            {
                                int percent = (int)((((double)bytesUploaded) / total) * 100.0 );
                                BeginInvoke( new Action( () => m_textBox1.Text = percent + "%" ) );
                            } );
                        MessageBox.Show( "Uploaded Successful" );

                    }
                    catch
                    {
                        MessageBox.Show( "Uploading Error..." );
                    }
                }
            }
You need to use BeginInvoke because progress callbacks will be called from threadpool threads. I assumed you are developing a Windows Forms application.

I hope this helps.

Sylwester
Viewing all 2955 articles
Browse latest View live


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