2
votes

Hey Im in trouble with my gitlab server on Ubuntu 14.04 64Bit Establish a connection via ssh is not working. The connection to the server via ssh with the same keys works fine. The key for github is saved at

/var/opt/gitlab/.ssh/authorized_keys

and begins with

command="/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell key-4",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa [...]

the auth.log gives the following message

input_userauth_request: invalid user git [preauth]

Connection closed by 139.13.201.xxx [preauth]

the output from ssh -vt

OpenSSH_7.1p2, OpenSSL 1.0.2e 3 Dec 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to xxx.com [85.214.233.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/hsync/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/hsync/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/hsync/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/hsync/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/hsync/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/hsync/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/hsync/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/hsync/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to xxxx.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client [email protected] <implicit> none
debug1: kex: client->server [email protected] <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:gIp2PDQMrB5497SLo+rflwFRdg8FJODSWPklNbgFHvo
debug1: Host 'felixschulze.com' is known and matches the ECDSA host key.
debug1: Found key in /home/hsync/.ssh/known_hosts:2
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/hsync/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/hsync/.ssh/id_dsa
debug1: Trying private key: /home/hsync/.ssh/id_ecdsa
debug1: Trying private key: /home/hsync/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

I ve found the following hint on gitlab faqs https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#ssh But there is no /home/git directory.

[1] git user in passwd

git:x:998:998::/var/opt/gitlab:/bin/sh

Hope you can give me any advise.

Thanks for helping

[1]Edit

2
What is the git user's home directory on the server? Could you edit your question to include the line for git in /etc/passwd?Kenster

2 Answers

1
votes

Oh, shame on me, I switched off PAM in the sshd_config, during some expirements with ssh and never switched it on.

0
votes

The SSH troubleshooting is written assuming GitLab is installed with a git account in /home/git (and include a /home/git/.ssh/authorized_keys)

If that is not your case, but ssh still uses 'git', that means your GitLab config still references the default user git

# Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
# user: git