Rest PUT vs POST actions by example
So, I just tried setting up login via public key on a new server and ran into the following error:
1debug1: SSH2_MSG_NEWKEYS sent2debug1: expecting SSH2_MSG_NEWKEYS3debug1: SSH2_MSG_NEWKEYS received4debug1: SSH2_MSG_SERVICE_REQUEST sent5debug1: SSH2_MSG_SERVICE_ACCEPT received6debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password7debug1: Next authentication method: publickey8debug1: Offering RSA public key: /Users/lightningspirit/.ssh/id_rsa9debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password10debug1: Next authentication method: password
What the hell?!
That wasn't helpful at all. Was my SSH config messed up? The client first tried public key authentication, but it was skipped.
After some time digging around, I finally figured out the issue: bad permissions in the .ssh directory.
Turns out, SSH doesn't like it when your home directory ~/
or ~/.ssh
directory have group write permissions. And honestly, that makes total sense to me as your home directory should only be writable by you, right?
So, I ran chmod 700 ~/.ssh
and chmod 600 ~/.ssh/authorized_keys
to fix the permissions.
There are other ways to solve this issue, such as disabling this strict mode (which I definitely wouldn't recommend at all).
Featured image by Travis Saylor