詹金斯ssh到亚马逊ec2实例

时间:2016-01-21 14:38:31

标签: linux jenkins ssh amazon-ec2

我是jenkins的新手,希望ssh到amazon 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

如何从构建中的jenkins“执行shell”部分ssh到ec2实例?请帮忙。

1 个答案:

答案 0 :(得分:1)

您需要通过SSH连接到jenkins主文件系统并将其放在Jenkins框中本地获取SSH密钥。

相关问题