3

While I have no problems making an SSH connection from one server to another, my Jenkins is still having a trouble connecting to the remote server while executing a managed script, which is as follows.

$ssh root@xxx.xxx.xxx.xxx

And the following is the message that is produced by Jenkins while building the project.

$ /bin/sh /tmp/build_step_template8225836097820612990.sh
Host key verification failed.

Additional information will be uploaded upon request.

Itai Ganot
  • 10,644
  • 29
  • 93
  • 146
marshallslee
  • 147
  • 1
  • 3
  • 6

1 Answers1

13

There are two ways to fix that.

First one is: Log into your Jenkins server and manually ssh to that machine and accept the key.

Second one is: Add the following to your ssh command:

-o StrictHostKeyChecking=no

Example:

ssh -i ~/.ssh/key.pem -o StrictHostKeyChecking=no ubuntu@1.1.1.1
Itai Ganot
  • 10,644
  • 29
  • 93
  • 146