The No Matching Key Exchange Method Found error on Mac occurs when users try to use SSH to get in touch with a remote server making their attempt to access to it unsuccessful. This is very frustrating and annoying for the users. However, this error is so common that you will often find UNIX types taking about how they are experiencing this issue and giving you advice on how to get rid of it.
In the UNIX word, these SSH servers and clients are used in different forms and versions. OpenSSH is one of them that allow users to securely log-in to a remote server. The OpenSSH is updated quite often but clients might be using an older version and the servers might be on different version that what leads to the error under discussion.
In other cases, the error entails the following: “18.104.22.168 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1”. Check the different fixes provided below and apply them on your Mac to resolve the problem:
Possible fixes for No Matching Key Exchange Method Found error on Mac
Fix 1: Enable Older key Exchange Methods
Sometimes, the Older Key exchange methods used by the clients can be enabled by the server so that the error under discussion could not be triggered anymore. You should go through the below steps to reconfigure the SSH Configuration:
- Open Terminal and execute the below command to open SSH Configuration file using NANO text editor:
sudo nano etc /ssh /ssh_config
- To this OpenSSH configuration file, add the below lines so as to enable the older key exchange methods to this server:
KexAlgorithms diffie-hellman-group1-sha1,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1 Ciphers 3des-cbc,blowfish-cbc,aes128-cbc,aes128-ctr,aes256-ctr
- Now, execute the below command to save the changes and regenerate SSH keys:
- Restart the SSH domain the then using the below command and check the next if No Matching Key Exchange Method Found error on Mac is resolved:
service ssh restart
Fix 2: Use PuTTY
PuTTY is an alternative for SSH client. It works better with key exchange methods. So, we recommend you use it instead of the current client and see if this works for you. To install it on your Mac, you should launch terminal and execute the below command:
sudo apt install putty
Fix 3: Enable SHA-1
If No Matching Key Exchange Method Found error on Mac remains, we recommend you go with the below workarounds that will surely help you to resolve this problem for you:
- Open Terminal and use the below command to open SSH Configuration file using NANO text editor:
sudo nano /etc /ssh /ssh_config
- Make sure you navigate through this file till you see the below lines:
MACs hmac-md5,hmac-sha1, [email protected],hmac-ripemd160
- From here, remove # and replace it with this:
MACs hmac-md5,hmac-sha1,hmac-sha2-256,[email protected],hmac-ripemd160
- Remove # from its start as well and locate the below line:
- Now, copy-paste the following at the end to complete the configuration of the file:
- Save it and then exit Nano editor,
- Check and see if this has fixed No Matching Key Exchange Method Found error on Mac.
That’s all! Now, we are rounding off our article how on to fix No Matching Key Exchange Method Found error. Hopefully, these fixes are helpful for you in getting rid of the problem from your Mac. Comment down below in case of any queries, questions and suggestions regarding the article.