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.

New-SSHSession : Key exchange negotiation failed. SecurityError: (Renci.SshNet.SshClient:SshClient)

See original GitHub issue

Windows Version Windows 10 Version 1803 (OS Build 17134.112) Powershell Version Major Minor Build Revision 5 1 17134 112

The problem is when I try to create an ssh session, I get the below.

$cred = New-Object System.Management.Automation.PSCredential ("user", (ConvertTo-SecureString "pass" -AsPlainText -Force))
$guestvm    = "192.168.1.15"
New-SSHSession -AcceptKey -ComputerName $guestvm -Credential $cred

New-SSHSession : Key exchange negotiation failed.
At line:1 char:1
+ New-SSHSession -AcceptKey -ComputerName $guestvm -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (Renci.SshNet.SshClient:SshClient 
   ) [New-SSHSession], SshConnectionException
    + FullyQualifiedErrorId : SSH.NewSshSession

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

30reactions
PoshKazuncommented, Oct 4, 2018

Try to remove: Get-SSHTrustedHost | Remove-SSHTrustedHost

2reactions
sudheeshjasmincommented, Jan 8, 2019

Thanks, the command “Get-SSHTrustedHost | Remove-SSHTrustedHost” fixed the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSHClient connect() "Failed to negotiate key exchange ...
Error "Failed to negotiate key exchange algorithm." Add-Type -Path 'C:\packages\Renci.SshNet.Async.1.4.0\lib\net40\Renci.SshNet.
Read more >
Key exchange negotiation failed - Power Platform Community
Getting "Key exchange negotiation failed" error in flow. Using ssh-rsa algorithm, I have tried with and without "ssh-rsa 2048" in.
Read more >
Why am I getting "Key exchanged failed" message on ...
I am writing an automated uploader using Visual Studio 2010 and C#. Using the code: Sftp client = new Sftp(); client.LogWriter = new...
Read more >
Cannot connect to SshClient in C# - Renci.SshNet error
I am working in C# and trying to use Renci.SshNet to create a connection so I can run SSH commands on a device...
Read more >
Unable to connect to SSH server using SSH.NET
Right now, I want to make the Linux machine reboot when I press a button. Here is what I have so far: Dim...
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