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


This is going to be a lovely short post.

Here's the issue:

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


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 'KexAlgorithms +diffie-hellman-group1-sha1' >> ~/.ssh/config  
dchidell@dchidell-mac:~$ cat ~/.ssh/config  
Host *.*.*.*  
   StrictHostKeyChecking no
   HostkeyAlgorithms +ssh-dss
   KexAlgorithms +diffie-hellman-group1-sha1
KexAlgorithms +diffie-hellman-group1-sha1  
dchidell@dchidell-mac:~$ ssh admin@  
Warning: Permanently added '' (RSA) to the list of known hosts.  
admin@'s password:  


Here's the line again:

echo 'KexAlgorithms +diffie-hellman-group1-sha1' >> ~/.ssh/config