I have 2 users on a system, user1 and user2.
Here is the md5sum of authorized_keys for each:
de092f77fb4a3be2cd8864c5f9961149 user1/.ssh/authorized_keys de092f77fb4a3be2cd8864c5f9961149 user2/.ssh/authorized_keys
Here is a list of the .ssh folder for each:
user1/.ssh/: total 8 drwx------. 2 user1 user1 28 Mar 16 12:11 . drwxrwx---. 5 user1 user1 4096 Mar 16 12:11 .. -rw-------. 1 user1 user1 412 Mar 16 12:11 authorized_keys user2/.ssh/: total 4 drwx------. 2 user2 user2 28 Mar 16 11:37 . drwx------. 3 user2 user2 90 Mar 16 11:38 .. -rw-------. 1 user2 user2 412 Mar 16 11:37 authorized_keys
Here is authentication with each:
debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/me/.ssh/id_rsa debug3: send_pubkey_test debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/me/.ssh/id_rsa debug3: send_pubkey_test debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 60 debug1: Server accepts key: pkalg ssh-rsa blen 279
In other words, I can log in with public key using user2, but not user1. Logging in with password works fine for both. I have no clue why this works with one user and not the other. And I need to get public key authentication to work with user1 (because I need to run scripts with an sshagent using public key authentication)
I am lost where to look for why this is not working. All guides online ask to check the key, the permissions, and regenerate. But all of the above looks correct. I find no mention of user1 in the /etc/ssh folder.
And if I provide the password, the login works fine.
Please note, I have edited the user names to anonymize the relevant data.