✓ Solved

SSH issue with new MacBook Pro Sonoma

I am setting up a new MacBook Pro with Sonoma and am having trouble with ssh key access. This machine is replacing an old MB Pro with High Sierra (last working OS for that hardware). Password access on the Debian Linode is disabled. I generated new rsa keys on the new MBP and added them to ~/.ssh/authorized_keys file on the Linode using the old MB to do so. I get the following error when attempting to log in:

user@machine Permission denied (publickey).

I have tried enabling password login (which worked for logging in from the new MBP), adding the keys, and then disabling PW access again. I still get the error message. I have tried copying the old machine's private key to the new machine (successful on other new setups), but that does not work either. I have tried both cat-ing and cut and pasting to get the key into the auth keys file. Nothing seems to work. Any ideas?

P.S. The ssh key access for other clients has continued to work without issue while this has been going on.

4 Replies

✓ Best Answer

The first thing I would try is looking at the verbose output. Try doing an ssh -v <your linode> from both your old and new MacBooks and compare them to see exactly where your new MacBook is going wrong.

Also, I would use the newer ed25519 key type instead of rsa. I don't know if it's related to your particular issue, but the newer keys are shorter and easier to copy around (and just as secure as rsa if not more secure).

My suggestion would be to rename the original ~/.ssh/authorized_keys file to ~/.ssh/authorized_keys.bak and create a brand new file to start from scratch from the new MacBook Pro. If you are able to create and upload a new key that works, then you can delete the .bak file or add any keys you need to the new file. You'll just need to make sure to leave a space between the keys in your file.

If you aren't able to create a new key from the new machine, this Troubleshoot SSH Key Authentication Issues guide should be helpful.

Finally, I found this article titled How to Fix SSH Not Working on MacOS Ventura / Sonoma that may have some useful info as well. It's worth noting though that I use a Mac with Ventura and I haven't had any issues.

Switching from rsa to ed25519 keys solved the problem. Tracking things down with ssh -v helped somewhat in discovering the problem. The auth process for the rsa keys was not behaving the same way on the Sonoma and High Sierra systems. Thank you to tlambert and procyon for their willingness to help resolve the issue.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct