question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KEX negotiation failed using curve25519-sha256

See original GitHub issue

With the develop branch, I’ve already ran a few times into a KEX failure:

Renci.SshNet.Common.SshConnectionException: Key exchange negotiation failed. at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout) at Renci.SshNet.Session.Connect() at Renci.SshNet.BaseClient.CreateAndConnectSession() at Renci.SshNet.BaseClient.Connect()

I’m testing again OpenSSH 8.0p1 (Ubuntu 19.10 Desktop).

The following simple code fragment should allow you to reproduce this issue:

using Renci.SshNet;
using System;
using System.Linq;
using System.Threading.Tasks;

class ConnectDisconnect
{
    private static void Main(string[] args)
    {
        if (args.Length != 3)
        {
            Console.Error.WriteLine("Please specify the host name, user name and password.");
            return;
        }

        var hostName = args[0];
        var userName = args[1];
        var password = args[2];

        var tasks = Enumerable.Range(1, 10).Select(y =>
            {
                return Task.Factory.StartNew(() =>
                    {
                        for (var i = 0; i < 500; i++)
                        {
                            using (SftpClient client = new SftpClient(args[0], userName, password))
                            {
                                client.Connect();
                                Console.Write(".");
                            }
                        }
                    });
            }).ToArray();

        Task.WaitAll(tasks);
    }
}

Note: It could take a while for this issue to reproduce.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
driesengcommented, Apr 21, 2020

I’ve fixed my changes, and up to now I’ve not been able to reproduce this issue again. I’ll commit the fix tomorrow.

1reaction
driesengcommented, Apr 16, 2020

@darinkes No problem, I can admit my mistakes. Like I always say: “I’ve made many mistakes, but I’m not married”. My gf doesn’t always appreciate this. Not sure why.

Read more comments on GitHub >

github_iconTop Results From Across the Web

key exhange negotiation failed though client and server ...
Unable to negotiate with XYZ port 22: no matching host key type found. Their offer: ssh-rsa fatal: Could not read from remote repository....
Read more >
JSch connection issue: JSchException: Algorithm ...
I am able to connect to the server using PuTTY but not using Java code. I am using jdk1.8.0_171. Here is the code...
Read more >
openssh - SSH stopped working after a server update ...
Turns out the new version was not broken - but OpenBSD/OpenSSH starting changing the key exchange defaults starting with OpenSSH-6.7p1 see: ...
Read more >
Putty SSH client key exchange fails after upgrade from ...
sshd[5210]: Unable to negotiate with 192.168.1.20 port 533 07: no matching key exchange method found. Their offer: diffie-hellman-group-exc ...
Read more >
Cannot connect SFTP server: Failed to negotiate key ...
Hi,. We are using the FTP provider with the sFTP protocol and got the following error: Cannot connect SFTP server: Failed to negotiate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found