为 gitlab 配置 ssh 运行程序 ssh denied
Posted
技术标签:
【中文标题】为 gitlab 配置 ssh 运行程序 ssh denied【英文标题】:Configuring ssh runner for gitlab ssh denied 【发布时间】:2017-11-19 20:22:55 【问题描述】:我正在尝试为 Angular 项目设置一个简单的 gitlab CI
我刚刚在登台服务器上做了一个跑步者。
这是 /etc/gitlab-runner 中 config.toml 的摘录
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]
我用 root 创建了一个 ssh 密钥,并在 gitlab deploys keys 中复制了公共部分。我之前做过 ssh-add。
当我使用跑步者时,我得到以下结果:
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
感谢您的帮助
【问题讨论】:
您可以尝试使用没有密码的密钥(因此不需要 ssh-agent)吗? 我没有密码 那么ssh-gent就不参与了。跑步者是否以 root 身份运行? 是的,config.toml 在根文件夹中。 可能你修改后没有重启sshd 【参考方案1】:我遇到了同样的问题。我将公钥附加到~/.ssh/authorized_keys
并取消注释/etc/ssh/sshd_config
文件中的AuthorizedKeysFile %h/.ssh/authorized_keys
行。然后我重新启动了 ssh 服务,它对我有用。
【讨论】:
以上是关于为 gitlab 配置 ssh 运行程序 ssh denied的主要内容,如果未能解决你的问题,请参考以下文章