简体   繁体   English

Jenkins Gerrit 触发器 - “/var/lib/jenkins/.ssh/id_rsa”不是有效的密钥文件

[英]Jenkins Gerrit Trigger - "/var/lib/jenkins/.ssh/id_rsa" is not a valid key file

I've installed Jenkins in an Ubuntu server by following the documentation from Jenkins Install documentation and I am trying to set up Gerrit Trigger Plugin .我已经按照 Jenkins 安装文档中的文档在 Ubuntu 服务器中安装了 Jenkins 并且我正在尝试设置Gerrit Trigger Plugin While setting up Administrative Settings section the SSH Keyfile section always gives the error "/var/lib/jenkins/.ssh/id_rsa" is not a valid key file.在设置管理设置部分时,SSH 密钥文件部分总是给出错误“/var/lib/jenkins/.ssh/id_rsa”不是有效的密钥文件。

I've generated the ssh keys as the Jenkins user in the default location "/var/lib/jenkins/"我在默认位置“/var/lib/jenkins/”中生成了 ssh 密钥作为 Jenkins 用户

I've tried generating the keys with ssh-keygen , ssh-keygen -t rsa , ssh-keygen -t rsa -b 2048 and the keys are generated with and without a passphrase also as pem file but still shows as invalid key file.我已经尝试使用ssh-keygenssh-keygen -t rsassh-keygen -t rsa -b 2048生成密钥,生成的密钥有密码短语也有密码短语,也有 pem 文件,但仍然显示为无效密钥文件。

The files are present in the "/var/lib/jenkins/.ssh/" location这些文件位于“/var/lib/jenkins/.ssh/”位置

jenkins@jenkins:~/.ssh$ ls -la
total 16
drwx------  2 jenkins jenkins 4096 Oct  9 14:18 .
drwxr-xr-x 17 jenkins jenkins 4096 Oct  9 14:18 ..
-rw-------  1 jenkins jenkins 2602 Oct  9 14:05 id_rsa
-rw-r--r--  1 jenkins jenkins  569 Oct  9 14:05 id_rsa.pub

I didn't find any log entries regarding this in jenkins log file also not in the web portal System Log section.我没有在 jenkins 日志文件中找到任何与此相关的日志条目,也不在 web 门户系统日志部分中。

I've installed Jenkins in an Ubuntu server by following the documentation from Jenkins Install documentation and I am trying to set up Gerrit Trigger Plugin .我已经按照 Jenkins 安装文档中的文档在 Ubuntu 服务器中安装了 Jenkins,我正在尝试设置Gerrit Trigger Plugin While setting up Administrative Settings section the SSH Keyfile section always gives the error "/var/lib/jenkins/.ssh/id_rsa" is not a valid key file.在设置管理设置部分时,SSH密钥文件部分总是给出错误“/var/lib/jenkins/.ssh/id_rsa”不是有效的密钥文件。

I've generated the ssh keys as the Jenkins user in the default location "/var/lib/jenkins/"我已经在默认位置“/var/lib/jenkins/”中以 Jenkins 用户的身份生成了 ssh 密钥

I've tried generating the keys with ssh-keygen , ssh-keygen -t rsa , ssh-keygen -t rsa -b 2048 and the keys are generated with and without a passphrase also as pem file but still shows as invalid key file.我尝试使用ssh-keygenssh-keygen -t rsassh-keygen -t rsa -b 2048生成密钥,并且生成的密钥有和没有密码也作为 pem 文件,但仍显示为无效密钥文件。

The files are present in the "/var/lib/jenkins/.ssh/" location这些文件位于“/var/lib/jenkins/.ssh/”位置

jenkins@jenkins:~/.ssh$ ls -la
total 16
drwx------  2 jenkins jenkins 4096 Oct  9 14:18 .
drwxr-xr-x 17 jenkins jenkins 4096 Oct  9 14:18 ..
-rw-------  1 jenkins jenkins 2602 Oct  9 14:05 id_rsa
-rw-r--r--  1 jenkins jenkins  569 Oct  9 14:05 id_rsa.pub

I didn't find any log entries regarding this in jenkins log file also not in the web portal System Log section.我没有在 jenkins 日志文件中找到任何与此相关的日志条目,也没有在门户网站系统日志部分中找到。

我遇到了同样的问题, ssh-keygen -m PEM 为我工作

Following are the steps worked for me.以下是对我有用的步骤。

  1. Currently my Jenkins home directory is pointing to /home/home_for_jenkins .And I need to use a different BOT user to fetch the Gerrit events.目前我的 Jenkins 主目录指向/home/home_for_jenkins 。我需要使用不同的 BOT 用户来获取 Gerrit 事件。

  2. In order to achieve the above requirement, I have generated ssh keys for BOT user by using ssh-keygen -m PEM command and copied the generated keys to /home/home_for_jenkins folder and changed the permissions accordingly为了实现上述要求,我使用ssh-keygen -m PEM命令为 BOT 用户生成了 ssh 个密钥,并将生成的密钥复制到/home/home_for_jenkins文件夹并相应地更改了权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM