为Gerrit和Hudson创建SSH密钥 [英] Creating SSH keys for Gerrit and Hudson
问题描述
我试图使用 Hudson
Gerrit Trigger
插件。
无论出于何种原因, Gerrit
不接受位于 /var/lib/hudson/.ssh/id_rsa的
/ code>。
在GUI中获得连接错误:com.jcraft.jsch.JSchException :身份验证失败
作为错误,当我在终端中 时,我得到一个权限被拒绝(publickey)
error。
如何生成并使用工作私钥,使 Hudson
和 Gerrit
可以打得好吗?
我实际上需要从
/ var / lib / hudson /中添加
用于用户(我)进入Gerrit GUI。SSH
.ssh / id_rsa.pub
然后从那里运行,就像一个魅力。
用户名必须请在Gerrit(admin帐户)中输入用户名。
我的原始建议如下:
使用基于Web的代码审查系统Gerrit的用户是什么?
该用户需要您的 /var/lib/hudson/.ssh/id_rsa.pub
其 $ HOME / .ssh / authorized_keys
,如本指南所示。
密钥分配
RSA密钥对的公共部分必须复制到任何将由客户。要复制的公钥信息应位于客户端的
〜/ .ssh / id_rsa.pub
文件中。
假设所有服务器都使用OpenSSH而不是一个不同的SSH实现,公钥数据必须附加到〜/ .ssh / authorized_keys
#首先将公钥从客户端上传到服务器
client $ scp〜/ .ssh / id_rsa.pub server.example.org:
#接下来,在服务器
server $ mkdir〜/ .ssh $ b上设置公钥$ b server $ chmod 700〜/ .ssh
server $ cat〜/ id_rsa.pub>> 〜/ .ssh / authorized_keys
server $ chmod 600〜/ .ssh / authorized_keys
server $ rm〜/ id_rsa.pub
确保将新的公钥数据附加到authorized_keys文件中,因为可能正在使用多个公钥。每个公钥输入必须位于不同的行上。
I'm trying to use the Hudson
Gerrit Trigger
plug-in.
For whatever reason, Gerrit
is not accepting the SSH
key located at /var/lib/hudson/.ssh/id_rsa
.
In the GUI I get Connection error : com.jcraft.jsch.JSchException: Auth fail
as an error, and when I'm working in the terminal I get a Permission denied (publickey)
error.
How can I generate and use a working private key so Hudson
and Gerrit
can play nice?
The OP Josh Smith managed to sort it out:
I'd actually needed to add the
SSH
key from/var/lib/hudson/.ssh/id_rsa.pub
for the user (me) into the Gerrit GUI.
Then from there it worked like a charm.
The username must be the username in Gerrit (the admin account).
My original advice is below:
What is the user which will use the web based code review system Gerrit?
That user needs your /var/lib/hudson/.ssh/id_rsa.pub
public ssh key in its $HOME/.ssh/authorized_keys
, as illustrated in this guide.
Key Distribution
The public portion of the RSA key pair must be copied to any servers that will be accessed by the client. The public key information to be copied should be located in the
~/.ssh/id_rsa.pub
file on the client.
Assuming that all of the servers use OpenSSH instead of a different SSH implementation, the public key data must be appended into the~/.ssh/authorized_keys
file on the servers.
# first, upload public key from client to server
client$ scp ~/.ssh/id_rsa.pub server.example.org:
# next, setup the public key on server
server$ mkdir ~/.ssh
server$ chmod 700 ~/.ssh
server$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
server$ chmod 600 ~/.ssh/authorized_keys
server$ rm ~/id_rsa.pub
Be sure to append new public key data to the authorized_keys file, as multiple public keys may be in use. Each public key entry must be on a different line.
这篇关于为Gerrit和Hudson创建SSH密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!