MeLightningspirit's Blog

Rest PUT vs POST actions by example

Barrier link fence.

So, I just tried setting up login via public key on a new server and ran into the following error:

1
debug1: SSH2_MSG_NEWKEYS sent
2
debug1: expecting SSH2_MSG_NEWKEYS
3
debug1: SSH2_MSG_NEWKEYS received
4
debug1: SSH2_MSG_SERVICE_REQUEST sent
5
debug1: SSH2_MSG_SERVICE_ACCEPT received
6
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
7
debug1: Next authentication method: publickey
8
debug1: Offering RSA public key: /Users/lightningspirit/.ssh/id_rsa
9
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
10
debug1: 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