Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring ssh runner for gitlab ssh denied

I'm trying to set up a simple gitlab CI for an angular project

I just made a runner on staging server.

Here is an extract of config.toml in /etc/gitlab-runner

  name = "awsTest10"
  url = "http://gitlab.XXXXXXX/ci"
  token = "XXXXXXXXXXXXXXXXXXXXX"
  executor = "ssh"
  [runners.ssh]
    user = "root"
    host = "ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com"
    port = "22"
    identity_file = "/root/.ssh/id_rsa"
  [runners.cache]

I created a ssh key with root and I copied the public part in gitlab deploys keys. I made ssh-add before.

When I use the runner I have the following result :

Running with gitlab-ci-multi-runner 1.11.1 (a67a225)
  on awsTest10 (e1ce142d)
Using SSH executor...
ERROR: Preparation failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Will be retried in 3s ...
ERROR: Job failed (system failure): ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Thanks for help

like image 811
chd Avatar asked Jun 17 '17 00:06

chd


1 Answers

I had the same problem. I appended public key to ~/.ssh/authorized_keys and uncomment AuthorizedKeysFile %h/.ssh/authorized_keys line in the /etc/ssh/sshd_config file. Then i restarted ssh service and it works for me.

like image 142
Yurii Sherbak Avatar answered Oct 18 '22 04:10

Yurii Sherbak