macos - 将 Mac Hudson 从机连接到 Linux 主机时 SSH key 身份验证失败

标签 macos ssh hudson master-slave

好的,我已经在 Ubuntu VM 中运行 Hudson (v1.393),并且一切正常。 不过,我正在尝试将 Mac 从属设备添加到 Ubuntu 主设备,但遇到了一些问题。

我已经设置了 SSH key ,以便 Ubuntu 虚拟机可以从命令行使用该 key 通过 ssh 连接到 Mac 上名为 hudson 的用户。

在 Hudson 从机配置中,我选择了“通过 SSH 在 Unix 计算机上启动从机代理”,并输入了主机 IP、从机上用户的用户名以及主机上我的私钥文件的位置(其中有已添加到从站上的授权 key 文件中)。

但是,主站无法连接到从站。 查看日志(如下),它正在尝试使用密码进行身份验证。

这是基于失败的 key 的 SSH 尝试的回退吗?
Hudson 是否仅尝试使用密码进行身份验证,我需要更改其他内容才能使其使用配置中定义的 key 文件?
是否无法在 Mac 上通过 ssh 启动从属代理? (我知道这种从属启动方法的名称明确指出了 Unix,但我在想(阅读:希望)它也适用于 OS X)

日志

[01/14/11 10:38:07] [SSH] Opening SSH connection to 10.0.1.188:22.
[01/14/11 10:38:07] [SSH] Authenticating as hudson/******.
java.io.IOException: Password authentication failed.
at com.trilead.ssh2.auth.AuthenticationManager.authenticatePassword(AuthenticationManager.java:319)
at com.trilead.ssh2.Connection.authenticateWithPassword(Connection.java:314)
at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:565)
at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:179)
at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:184)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.io.IOException: Authentication method password not supported by the server at this stage.
at com.trilead.ssh2.auth.AuthenticationManager.authenticatePassword(AuthenticationManager.java:289)
... 9 more
[01/14/11 10:38:07] [SSH] Connection closed.

如果有人以前成功克服过这种类型的设置,或者有任何提示或想法,我将非常感激! 谢谢

最佳答案

我最近遇到了同样的问题,尝试使用 SSH 在 Mac OS X 10.6 计算机上启动代理。

要使密码身份验证起作用,您需要在客户端节点上编辑/etc/sshd_config,设置 PasswordAuthentication yes

在 Hudson 仪表板中使节点脱机,确保配置具有有效的用户名和密码,然后启动代理。另请确保Remote FS 根目录由您所连接的构建用户拥有。

对于无密码 ssh 身份验证,首先检查 Hudson master 正在以哪个用户身份运行。让我们假设这是tomcat55。生成公共(public)/私有(private) SSH key 对(使用空密码),然后验证 Hudson 用户是否可以连接。

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/tomcat55/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/tomcat55/.ssh/id_rsa.
Your public key has been saved in /home/tomcat55/.ssh/id_rsa.pub.

$ # authorize the hudson master on the hudson node
$ scp /home/tomcat55/.ssh/id_rsa.pub hudson@macnode:~/.ssh/authorized_keys
$ # test the connection
$ ssh -i /home/tomcat55/.ssh/id_rsa hudson@macnode

在 Hudson mac 节点上,/etc/sshd_config 需要允许无密码访问。

Protocol 2
PubkeyAuthentication yes

在节点配置中清除密码字段,并设置私钥字段(在本例中为/home/tomcat55/.ssh/id_rsa)。您现在应该能够启动代理:

[01/19/11 22:38:44] [SSH] Opening SSH connection to macnode:22.
[01/19/11 22:38:44] [SSH] Authenticating as hudson with /home/tomcat55/.ssh/id_rsa.
[01/19/11 22:38:45] [SSH] Authentication successful.

关于macos - 将 Mac Hudson 从机连接到 Linux 主机时 SSH key 身份验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4715393/

相关文章:

maven - 为什么要为Jenkins使用SonarQube插件,而不是简单地使用Maven目标 Sonar : Sonar ?

css - 如果 outline-style 设置为 "solid"(而不是 "auto"),则 Chrome 上的轮廓绘制不正确

python - 运行 Bootstrap 时为 "LookupError: unknown encoding: ascii"

macos - 假设我知道root密码,如何在OS X中使用标准帐户制作一个sudo本身的Bash脚本?

build - 缓慢的复杂构建和 Hudson 与 Electric Cloud

java - 使用 Hudson 和 Maven 为多个平台发布应用程序

在 macOS Sierra 上使用 OpenSSL 的 python 请求

python - 如果进程正在运行,如何使用 Python 检查 Mac OSX

linux - 在 Bash 脚本中使用 Expect 为 SSH 命令提供密码

ubuntu - 没有用于本地开发的 auth 登录 ssh