/ 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:

dchidell@dchidell-mac:~$ ssh admin@1.1.12.40
Unable to negotiate with 1.1.12.40 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
dchidell@dchidell-mac:~$ 

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:

dchidell@dchidell-mac:~$ echo -e 'Host *.*.*.*\n\tKexAlgorithms +diffie-hellman-group1-sha1' >> ~/.ssh/config
dchidell@dchidell-mac:~$ cat ~/.ssh/config
Host *.*.*.*
   KexAlgorithms +diffie-hellman-group1-sha1
dchidell@dchidell-mac:~$ ssh admin@1.1.12.40
Warning: Permanently added '1.1.12.40' (RSA) to the list of known hosts.
admin@1.1.12.40'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