MacOS – Mavericks update broke ssh key-based authentication

authenticationmacosssh

I regularly ssh to one of my OS X boxes. I have configured ssh key-based authentication i.e. added my client-end ~/.ssh/id_rsa.pub to server-end ~/.ssh/authorized_keys2 with restricted enough permissions. This setup has worked fine for years over multiple OS X versions.

However, upgrading to OS X 10.9 Mavericks broke this setup. ssh login prompts for password. Logging in with password works but I want passwordless key-based authentication.

(I know the solution to this now. Documenting it here in case it helps others.)

Best Answer

Turns out it was about the key file name.

authorized_keys2 was the correct one to use for SSH2 keys a loooong time ago when I first configured the key-based authentication. For years, authorized_keys2 file was deprecated but still working. In Mavericks version of opensshd the support has been dropped.

This can be fixed with a simple rename:

cd ~/.ssh; mv authorized_keys2 authorized_keys