SOLVED: Gitlab SSH connection dropped (key auth OK)

(UPDATE: This issue is solved. Just had to enable PAM authentication.)

Hi, I’ve just installed a fresh copy of Gitlab 12.9.3-ee on RHEL 7.6. I’m able to log in, create a repo, and clone over HTTP.

SSH, however, doesn’t work. I have added an SSH key to my account and I can tell from debug that my key is accepted, but the connection is immediately dropped. If I ssh directly (as git), the connection is again dropped and no “Welcome to Gitlab” text is shown. I can, however, ssh in as another user.

As far as I understand, there’s a process called Gitlab Shell that’s meant to manage ssh connections and I suspect it’s not working properly. However, it’s not clear to me how to troubleshoot it. (I have limited access to the host, and need to ask a system admin to issue commands for me.)

I understand that ~git/.ssh/authorized_keys is meant to have a “command=” directive that passes control to Gitlab Shell, and I don’t know if it does (have asked our sysadmin to check). Meanwhile, is there anything else to check or change here?

$ ssh -vT git@myhostname
[...]
debug1: Offering public key: /home/myuser/.ssh/id_ecdsa ECDSA SHA256:xxx
debug1: Server accepts key: /home/myuser/.ssh/id_ecdsa ECDSA SHA256:xxx
Connection closed by 10.153.161.112 port 22
$ GIT_SSH_COMMAND="ssh -vT" git clone git@myhostname:myrepo.git
Cloning into 'myrepo'...
OpenSSH_8.0p1, OpenSSL 1.1.1c FIPS  28 May 2019
[...]
debug1: Offering public key: /home/myuser/.ssh/id_ecdsa ECDSA SHA256:xxx
debug1: Server accepts key: /home/myuser/.ssh/id_ecdsa ECDSA SHA256:xxx
Connection closed by 10.153.161.112 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.