So once in a while I’ll run into a problem where I can log into a server via SSH
as one user via public key, and taking the
authorized_keys keys and dumping
it into another user’s
.ssh/ folder doesn’t work.
There are a few things you can try.
chmod 0700 .ssh/ chmod 0600 .ssh/authorized_keys sudo chown -R myuser:mygroup .ssh/
That should fix it 99% of the time.
Tonight I had an issue where the permissions were all perfect…checked, double checked, and yes they were fine.
So after poking at it for an hour (instead of smartly checking the logs) I decided to check the logs. I saw this error:
Nov 23 05:26:46 localhost sshd: User deploy not allowed because account is locked Nov 23 05:26:46 localhost sshd: input_userauth_request: invalid user deploy [preauth]
Huh? I looked it up, and apparently an account can become locked if its password is too short or insecure. So I did
sudo passwd deploy
Changed the password to something longer, and it worked!
Have any more tips on fixing SSH login issues? Let us know in the comments below.