/ Linux

Fixing "'no matching key exchange method found. Their offer: diffie-hellman-group1-sha1" on Mac

Problem:

This is going to be a lovely short post.

Here's the issue:

[email protected]:~$ ssh [email protected]
Unable to negotiate with 1.1.12.40 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
[email protected]:~$ 

Solution:

Ideally we'd fix the server so that is supports a secure key exchange mechanism. Often that's not possible, and from a test perspective it's far easier to workaround the issue on the client.

So, from a client perspective you can do this:

[email protected]:~$ echo -e 'Host *.*.*.*\n\tKexAlgorithms +diffie-hellman-group1-sha1' >> ~/.ssh/config
[email protected]:~$ cat ~/.ssh/config
Host *.*.*.*
   KexAlgorithms +diffie-hellman-group1-sha1
[email protected]:~$ ssh [email protected]
Warning: Permanently added '1.1.12.40' (RSA) to the list of known hosts.
[email protected]'s password: 
<omitted>

Sorted!

Here's the line again:

echo -e 'Host *.*.*.*\n\tKexAlgorithms +diffie-hellman-group1-sha1' >> ~/.ssh/config
Fixing "'no matching key exchange method found. Their offer: diffie-hellman-group1-sha1" on Mac
Share this