The other day I decided to upgrade to macOS Sonoma. As usual, when you do an OS upgrade something breaks. I was not able to SSH to an old Linux server.

Before, when on macOS BigSur I was able to SSH to any Linux box from my Terminal. My guess is OpenSSH improved security. Anyways, I decided to take a walk during the NYC Marathon, take some photos and then take on this one.

After upgrading from macOS BigSur to Sonoma I tried to SSH to a Linux box I normally do for a client and got the below error:

Unable to negotiate with <TheOldServerName> port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

WTF! The solution for now is to include the below flags in your ssh command:

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-rsa myuser@<TheOldServerName>

This allowed me to login. I had to combine both options because I was also getting error:

'no matching key exchange method'

Hope this quick ssh tip helps somebody that just updated to macOS Sonoma. You can always contact me if you have any questions.

Leave a comment

Your email address will not be published. Required fields are marked *