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

New Post: Connecting with Password AND Private Key File using SftpClient

$
0
0
Hm, looks like they have this in their config:
AuthenticationMethods pubkey,password 
So user have to auth with a valid pubkey and password.
A "quite new" feature of SSH from march last year, I don't think it is part of the SSH.Net yet.

I think you have to wait for a developer to help you with that.

New Post: Connecting with Password AND Private Key File using SftpClient

$
0
0
Ignore my previous post - it worked! I had a wrong port..

thanks again!
dave

New Post: Connecting with Password AND Private Key File using SftpClient

$
0
0
ah! awesome! good to know for me too! :)

Reviewed: 2013.4.7 (Mar 20, 2014)

$
0
0
Rated 4 Stars (out of 5) - It's a little rough around the edges, but very promising.

New Post: Connecting with Password AND Private Key File using SftpClient

$
0
0
I just tried it with following line in my sshd_config:
AuthenticationMethods password,password
So I have to enter the password twice. Which is totally valid.

Works fine with Putty or openssh, but fails with SSH.Net.
SSH.Net tries to be clever and counts/filters allowed auths vs. tried auths.
Which why it ignores the PartialSuccess-Message of the first password attempt.

following diffs fixes this:
--- a/Renci.SshNet/ConnectionInfo.cs
+++ b/Renci.SshNet/ConnectionInfo.cs
@@ -411,7 +411,7 @@ public bool Authenticate(Session session)
             while (authenticated != AuthenticationResult.Success)
             {
                 // Find first authentication method
-                var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name) && !triedAuthentications.Contains(a.Name)).FirstOrDefault();
+                var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name)).FirstOrDefault();
                 if (method == null)
                     throw new SshAuthenticationException("No suitable authentication method found to complete authentication.");

@@ -419,7 +419,7 @@ public bool Authenticate(Session session)

                 authenticated = method.Authenticate(session);

-                if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null && method.AllowedAuthentications.Count() < allowedAuthentications.Count()))
+                if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null))
                 {
                     // If further authentication is required then continue to try another method
                     allowedAuthentications = method.AllowedAuthentications;
@@ -427,7 +427,7 @@ public bool Authenticate(Session session)
                 }

                 // If authentication Fail, and all the authentication have been tried.
-                if (authenticated == AuthenticationResult.Failure && (triedAuthentications.Count() == allowedAuthentications.Count()))
+                if (authenticated == AuthenticationResult.Failure)
                 {
                     break;
                 }
I will open an issue.

Created Unassigned: No Connection possible with the same auth method requested multiple times [1930]

$
0
0
If you try to connect to a server which requires more than one auth,
it only works it the auth-methods differ.

If you use:
```
AuthenticationMethods password,password
```
or
```
AuthenticationMethods pubkey,pubkey
```

it will fail with "no suitable auth methods..."

But this server config works with OpenSSH and Putty.

I nailed the issue down to Authenticate() in ConnectionInfo, where SSH.Net filters and counts auth-methods.
So a auth method can just used once!

Following quickpatch fixes the isse:

```
--- a/Renci.SshNet/ConnectionInfo.cs
+++ b/Renci.SshNet/ConnectionInfo.cs
@@ -411,7 +411,7 @@ public bool Authenticate(Session session)
while (authenticated != AuthenticationResult.Success)
{
// Find first authentication method
- var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name) && !triedAuthentications.Contains(a.Name)).FirstOrDefault();
+ var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name)).FirstOrDefault();
if (method == null)
throw new SshAuthenticationException("No suitable authentication method found to complete authentication.");

@@ -419,7 +419,7 @@ public bool Authenticate(Session session)

authenticated = method.Authenticate(session);

- if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null && method.AllowedAuthentications.Count() < allowedAuthentications.Count()))
+ if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null))
{
// If further authentication is required then continue to try another method
allowedAuthentications = method.AllowedAuthentications;
@@ -427,7 +427,7 @@ public bool Authenticate(Session session)
}

// If authentication Fail, and all the authentication have been tried.
- if (authenticated == AuthenticationResult.Failure && (triedAuthentications.Count() == allowedAuthentications.Count()))
+ if (authenticated == AuthenticationResult.Failure)
{
break;
}
```

Commented Unassigned: No Connection possible with the same auth method requested multiple times [1930]

$
0
0
If you try to connect to a server which requires more than one auth,
it only works it the auth-methods differ.

If you use:
```
AuthenticationMethods password,password
```
or
```
AuthenticationMethods pubkey,pubkey
```

it will fail with "no suitable auth methods..."

But this server config works with OpenSSH and Putty.

I nailed the issue down to Authenticate() in ConnectionInfo, where SSH.Net filters and counts auth-methods.
So a auth method can just used once!

Following quickpatch fixes the isse:

```
--- a/Renci.SshNet/ConnectionInfo.cs
+++ b/Renci.SshNet/ConnectionInfo.cs
@@ -411,7 +411,7 @@ public bool Authenticate(Session session)
while (authenticated != AuthenticationResult.Success)
{
// Find first authentication method
- var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name) && !triedAuthentications.Contains(a.Name)).FirstOrDefault();
+ var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name)).FirstOrDefault();
if (method == null)
throw new SshAuthenticationException("No suitable authentication method found to complete authentication.");

@@ -419,7 +419,7 @@ public bool Authenticate(Session session)

authenticated = method.Authenticate(session);

- if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null && method.AllowedAuthentications.Count() < allowedAuthentications.Count()))
+ if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null))
{
// If further authentication is required then continue to try another method
allowedAuthentications = method.AllowedAuthentications;
@@ -427,7 +427,7 @@ public bool Authenticate(Session session)
}

// If authentication Fail, and all the authentication have been tried.
- if (authenticated == AuthenticationResult.Failure && (triedAuthentications.Count() == allowedAuthentications.Count()))
+ if (authenticated == AuthenticationResult.Failure)
{
break;
}
```
Comments: ** Comment from web user: da_rinkes **

Just to be clear, the patch is not a real patch! It just gives a basic idea where the problem is.

New Post: Connecting with Password AND Private Key File using SftpClient

$
0
0
On a related note, using "SftpClient(host, port, user, password)" signature doesn't work for certain hosts, but used to work with the Tamir.SharpSsh lib.

I get back "Bad packet length 3217085959" message on connect.

Do I need to do something special for password authentications that I am not doing?

thanks!

New Post: Connecting with Password AND Private Key File using SftpClient

$
0
0
What does certain hosts mean? Do they differ from others?
There is nothing special needed i know of.

New Post: Connecting with Password AND Private Key File using SftpClient

$
0
0
It works if I connect to some hosts with user/password, but not others. I can't list them here unfortunately...

New Post: Local port forwarding: how to detect that no process is listening on remote port?

$
0
0
Hello,

I ran into this problem while forwarding local port X (client:X) to port Y of the ssh server (server:Y): even if no process is listening on port Y on the ssh server, I can still connect to client:X (which is normal) and I don't get error messages nor exceptions concerning the fact that ssh.net can't connect to server:Y (and this is less normal).

I can even send data to the connected socket without error messages.

Do you know if there is a way to detect this situation? Maybe I neglected something?

Thanks a lot for your help,
Alberto.

New Post: Connecting with Password AND Private Key File using SftpClient

$
0
0
But you can give some informations about the servers?
Like OS, SSH Version etc.

Maybe this can give us a hint how they differ.

New Post: PortForwading Bug

$
0
0
Hello,

I'm worry to announce this problem is still present under Windows XP.

The SqlConnection.ClearAllPools() solution runs fine under Windows 7, but under XP breaks still.

I debug just this code:
    //  Wait for key exchange to be completed
                    this.WaitHandle(this._keyExchangeCompletedWaitHandle);

                    //  If sessionId is not set then its not connected
                    if (this.SessionId == null)
                    {
                        this.Disconnect();
                        return;
                    }

                    //  Request user authorization service
                    this.SendMessage(new ServiceRequestMessage(ServiceName.UserAuthentication));

                    //  Wait for service to be accepted
                    this.WaitHandle(this._serviceAccepted);
On Session.cs file

The exception shows:

"No se controló System.NullReferenceException
Message=Referencia a objeto no establecida como instancia de un objeto.
InnerException: "

on

private void Session_ErrorOccured(object sender, Common.ExceptionEventArgs e)
    {
        this._listener.Stop();
    }

This exception only appears the second time that I open the connection.
The example also fails on XP SP3 machine, without the SQLCOnnection.clearallpools() only opens the portforwading to one server, and the second tunnel stay to the first connection,

With the clearallpools() also rasie the exception System.NullReferenceException

:_(((
:_((

I try with Chilkat demo, and run fine, using the SQLCOnnectino.clearallpools()

I would like solve the SSH.NET problem,

please help.

New Post: PortForwading Bug

$
0
0
Sorry, Its not an SSH.NET bug/problem. It's an bug of your app.
Btw. Please use english exceptions and post code.
Else it's just guessing,

Edited Issue: No Connection possible with the same auth method requested multiple times [1930]

$
0
0
If you try to connect to a server which requires more than one auth,
it only works it the auth-methods differ.

If you use:
```
AuthenticationMethods password,password
```
or
```
AuthenticationMethods pubkey,pubkey
```

it will fail with "no suitable auth methods..."

But this server config works with OpenSSH and Putty.

I nailed the issue down to Authenticate() in ConnectionInfo, where SSH.Net filters and counts auth-methods.
So a auth method can just used once!

Following quickpatch fixes the isse:

```
--- a/Renci.SshNet/ConnectionInfo.cs
+++ b/Renci.SshNet/ConnectionInfo.cs
@@ -411,7 +411,7 @@ public bool Authenticate(Session session)
while (authenticated != AuthenticationResult.Success)
{
// Find first authentication method
- var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name) && !triedAuthentications.Contains(a.Name)).FirstOrDefault();
+ var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name)).FirstOrDefault();
if (method == null)
throw new SshAuthenticationException("No suitable authentication method found to complete authentication.");

@@ -419,7 +419,7 @@ public bool Authenticate(Session session)

authenticated = method.Authenticate(session);

- if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null && method.AllowedAuthentications.Count() < allowedAuthentications.Count()))
+ if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null))
{
// If further authentication is required then continue to try another method
allowedAuthentications = method.AllowedAuthentications;
@@ -427,7 +427,7 @@ public bool Authenticate(Session session)
}

// If authentication Fail, and all the authentication have been tried.
- if (authenticated == AuthenticationResult.Failure && (triedAuthentications.Count() == allowedAuthentications.Count()))
+ if (authenticated == AuthenticationResult.Failure)
{
break;
}
```
Comments: ** Comment from web user: drieseng **

I've fixed this issue locally.
Once I've done some more tests, I'll commit the changes.
Thanks for the report!


Source code checked in, #34949

Source code checked in, #34953

$
0
0
* Introduce ClientChannel and ServerChannel classes to distinguish between channel initiated by the client or the server. * Increase maximum SSH packet size to 68536 bytes (64 KB + 3000 bytes). * Increase local window size to 2 MB. * Increase local maximum packet size from 32 KB to 64 KB. * Modify Channel to save remote channel info (packet size, window size and channel number); distinguish between local and remote packet size. * Expose channel in SubsystemSession to allow SftpSession to access local and remote maximum packet size for calculation of optimal read and write (buffer) length. * Move verification of maximum data payload to send to Channel.SendMessage and verify data length against remote packet size. * Limit size of payload to send to peer to RemotePacketSize in ChannelForwardedTcpip and ChannelDirectTcpip. * Disable debug symbols when building in Release configuration.

Source code checked in, #34957

$
0
0
Issue #1930: No connection possible with the same auth method requested multiple times. Improve exception message for authentication failures.

Edited Issue: No Connection possible with the same auth method requested multiple times [1930]

$
0
0
If you try to connect to a server which requires more than one auth,
it only works it the auth-methods differ.

If you use:
```
AuthenticationMethods password,password
```
or
```
AuthenticationMethods pubkey,pubkey
```

it will fail with "no suitable auth methods..."

But this server config works with OpenSSH and Putty.

I nailed the issue down to Authenticate() in ConnectionInfo, where SSH.Net filters and counts auth-methods.
So a auth method can just used once!

Following quickpatch fixes the isse:

```
--- a/Renci.SshNet/ConnectionInfo.cs
+++ b/Renci.SshNet/ConnectionInfo.cs
@@ -411,7 +411,7 @@ public bool Authenticate(Session session)
while (authenticated != AuthenticationResult.Success)
{
// Find first authentication method
- var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name) && !triedAuthentications.Contains(a.Name)).FirstOrDefault();
+ var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name)).FirstOrDefault();
if (method == null)
throw new SshAuthenticationException("No suitable authentication method found to complete authentication.");

@@ -419,7 +419,7 @@ public bool Authenticate(Session session)

authenticated = method.Authenticate(session);

- if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null && method.AllowedAuthentications.Count() < allowedAuthentications.Count()))
+ if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null))
{
// If further authentication is required then continue to try another method
allowedAuthentications = method.AllowedAuthentications;
@@ -427,7 +427,7 @@ public bool Authenticate(Session session)
}

// If authentication Fail, and all the authentication have been tried.
- if (authenticated == AuthenticationResult.Failure && (triedAuthentications.Count() == allowedAuthentications.Count()))
+ if (authenticated == AuthenticationResult.Failure)
{
break;
}
```
Comments: ** Comment from web user: drieseng **

Fixed in changeset 34957.

Commented Unassigned: sftpfilestream read is very slow. [1919]

$
0
0
Sftpfile stream is very slow it took 1hr 15 mins for 400mb file.
Is there any way to increase the read buffer of the sftpfilestream.
sftp.buffersize is for upload i believe. But i tried changing it no luck.
Comments: ** Comment from web user: drieseng **

I've committed the changes today.
Can you build from SVN, and check if improves performance substantially for you ?

Viewing all 2955 articles
Browse latest View live