【问题标题】:Jenkins ssh to amazon ec2 instance詹金斯 ssh 到亚马逊 ec2 实例
【发布时间】:2016-04-27 20:52:03
【问题描述】:

我是 jenkins 的新手,想通过 ssh 连接到亚马逊 ec2 实例并在那里执行一些步骤。现在我只是想通过 ssh 连接到我的亚马逊实例。我正在使用“执行 shell”在 EC2 上执行命令。不,我刚刚放了 ssh ec2-user@ 命令。我不明白在哪里,所以我指定了连接到实例的 ssh 密钥。现在,如果我运行构建,我会收到以下错误:

Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/LAD/workspace
[workspace] $ /bin/sh -xe /tmp/hudson4524738745485196769.sh
+ ssh -v ec2-user@<my ip address>
OpenSSH_6.6.1, OpenSSL 1.0.1k-fips 8 Jan 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
Pseudo-terminal will not be allocated because stdin is not a terminal.
debug1: Connecting to <my ip address> [<my ip address>] port 22.
debug1: Connection established.
debug1: identity file /var/lib/jenkins/.ssh/id_rsa type -1
debug1: identity file /var/lib/jenkins/.ssh/id_rsa-cert type -1
debug1: identity file /var/lib/jenkins/.ssh/id_dsa type -1
debug1: identity file /var/lib/jenkins/.ssh/id_dsa-cert type -1
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa type -1
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa-cert type -1
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519 type -1
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: curve25519-sha256@libssh.org need=16 dh_need=16
debug1: kex: curve25519-sha256@libssh.org need=16 dh_need=16
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 74:0d:73:17:f2:78:c4:51:e4:c4:55:8f:6d:94:9f:7a
debug1: read_passphrase: can't open /dev/tty: No such device or address
Host key verification failed.
Build step 'Execute shell' marked build as failure
Finished: FAILURE

如何从构建中的詹金斯“执行外壳”部分 ssh 进入 ec2 实例?请帮忙。

【问题讨论】:

  • 如果你想通过 ssh 在远程机器上运行 shell 命令,你可以使用 SSH Plugin wiki.jenkins-ci.org/display/JENKINS/SSH+plugin 希望对你有帮助
  • 嗨@HussainZKathawala 我已经添加了ssh插件。我去管理jenkins->配置系统->SSH远程主机->添加。它问我一个密钥文件路径?我已经在我的实例上生成了一个公钥,但是它如何在 jenkins 仪表板上提供它。没有上传甚至粘贴关键内容的选项。
  • 您可以使用 PublishOverSSHPlugin 完美运行。 wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin

标签: linux jenkins ssh amazon-ec2


【解决方案1】:

您需要通过 SSH 连接到 jenkins 主文件系统并将其放置在那里,从而在 Jenkins 机器上本地拥有 SSH 密钥。

【讨论】:

    猜你喜欢
    • 2016-04-27
    • 2010-12-28
    • 2018-04-17
    • 1970-01-01
    • 2014-10-08
    • 2014-03-30
    • 2017-08-16
    • 2012-05-13
    • 1970-01-01
    相关资源
    最近更新 更多