I have set up a Raspberry Pi 4 with the current Raspberry Pi OS in my home network. When I try to connect to it via ssh I get:

Unable to negotiate with 192.168.xxx.xxx port 22: no matching key exchange method found. Their offer:
 [email protected],
 [email protected],

(inserted line breaks for readability)

So I inserted into my .ssh/config on my Macbook:

Host myraspberrypi
    HostName 192.168.xxx.xxx
    User me
    KexAlgorithms diffie-hellman-group16-sha512

Then the answer to ssh myraspberrypi was again:

Unable to negotiate with 2001:xxxx...xxxx port 22: no matching key exchange method found. Their offer: [email protected],curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256

(Note the ipv6 address here!?)

How can I make my Macbook talk to the raspberry pi?

  • 1
    What's the output of ssh -V and ssh -Q kex on your macbook? You may have outdated ssh on that...
    – vidarlo
    Feb 2 at 19:02
  • ssh -Vis OpenSSH_9.4p1, LibreSSL 3.3.6.
    – jammon
    Feb 2 at 20:31
  • ssh -Q kex: diffie-hellman-group1-sha1 diffie-hellman-group14-sha1 diffie-hellman-group14-sha256 diffie-hellman-group16-sha512 diffie-hellman-group18-sha512 diffie-hellman-group-exchange-sha1 diffie-hellman-group-exchange-sha256 ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 curve25519-sha256 [email protected] [email protected]
    – jammon
    Feb 2 at 20:32
  • Curious. That's from your macbook? There's several overlapping KEX there...
    – vidarlo
    Feb 2 at 22:07
  • Solved. It was my fault, there was another host specification in the .ssh/config that conflicted with the new raspberry pi. Sorry for the disturbance!
    – jammon
    Feb 3 at 13:34

1 Answer 1


Most of your post is a red herring; MacOS & Pi have mostly identical kex.

WHY do people bother hiding private IP addresses?

Use proper addressing e.g myraspberrypi.local

Have you set public keys on the Pi?
What IP addresses are in use?
Why specify kex - let systems negotiate a common key exchange method?

My Mac .ssh/config in part (although you may disagree with some settings)

Host 10.1.*.*
   StrictHostKeyChecking no
   UseKeychain yes
   BatchMode yes
   PasswordAuthentication yes
   User xxx

Host Pi5
        Hostname …Pi5.local

  • You are totally right, it was a mistake on my side. I forgot that I had a raspberry pi with the same name in a different network. There was a host specification in my somewhat lengthy .ssh/config that conflicted with the new pi.
    – jammon
    Feb 3 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.