Ssh key not working for just one user

I am the system adminsitator of an small organization where we host our own gitlab-ce 12.2 instance. Everything worked great until the day I broke things.

This is what happened:

  • We have an Ansible script that upload ssh keys of our team members to several servers. I ran the script to the gitlab server and override the /var/opt/gitlab/.ssh/authorized_keys file.
  • After that no one could push, pull or clone the repos. I was freacking out, so I try to find a solution before the developers got mad. I try to remove my key and uploaded again from the gitlan web interface. It did not worked.
  • So after failing with this approach I thought it would be wiser to replaze the authorized_keys file with a backups and did that.
  • After that the problem was solved for everyone, except me! Yes the sysadmin is the only one that could not update the re repos.

I get this message:

> GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.

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

When I try to ssh to the server I get this message:

ssh git@gitlab.mycool.domain
PTY allocation request failed on channel 0
Welcome to GitLab, **Anonymous**!
Connection to gitlab.autonomia.digital closed.

When a teammate does the same he gets the same message, but instead of Anonymous, he gets @hisUsername.

When I do the ssh with the -v option I can see that the public key is accepted:

debug1: Offering RSA public key: /home/xxxx/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: Authentication succeeded (publickey).

It seems that for some reason my user is not associated to my public key. Any idea how to fix this?

Thank you!

I also found this weird lines full of “###” in the authorized_keys file:

 ################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################

I guess I could just delete them?

@cholan Please take a look at https://docs.gitlab.com/ee/administration/raketasks/maintenance.html#rebuild-authorized_keys-file and see if that fixes the issue.

4 Likes

Tanks a lot!!! I solve the problem.

1 Like

Saved my day