I've been working through a problem for the past week or so and I am running out of ideas.
I added a new user on my Centos 7 VPS for a git server, and (under the advice of several articles) placed the user's home directory inside /var
instead of /home
.
Then, I tried using ssh to log into that user, and it worked correctly. However, public key authentication did not work correctly. In the debugging process, I eventually made the git
user and the primary user identical in every way -- they were both sudoers, they had the same .ssh
directories, with the same authorized_keys
files, and I even moved the git
user to /home
, but to no avail.
To test further, I created two new users: test1
and test2
. test1
's home directory was in /home
, and test2
's home directory was in /var
. Sure enough, pubkey auth worked for test1
and not test2
. I don't think it's a permissions issue, because /var
has the same permissions that /home
does, and the user directories all have correct permissions. Additionally, I am very perplexed that the original git
user did not accept pubkey auth even after moving it to /home
.
If I run ssh in verbose mode, I can see that the holdup occurs after sending the key:
debug1: Offering RSA public key: /home/user/.ssh/foo.key
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
When connecting to the primary user, or to test1
, it acts differently:
debug1: Offering RSA public key: /home/user/.ssh/foo.key
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
The only clue I have found: I get an identical response to the first one (waiting for reply, then skipping pubkey auth) when trying to login as a nonexistent user. So, is the machine making the git
user invisible to the outside world? Why would it do that?
I can normally work through these things, but I think I'm pretty much stumped this time around. Thanks for any help!