Here are my jenkins config:
Error message:
/var/jenkins_home/.ssh/known_hosts [SSH] No Known Hosts file was found at /var/jenkins_home/.ssh/known_hosts. Please ensure one is created at this path and that Jenkins can read it.
No matter how much I tried it doesn't work. I've read this post, but still no solution.
I got the same error while launching slave.It has to do with the SSH Slave Plugin
. What worked for me was changing the Host key verification strategy in LAUNCH METHOD from "Known Hosts file verification strategy
" to "Manually trusted key verification strategy"
.
CONFIGURE AGENT -> LAUNCH METHOD -> Manually trusted key verification strategy - > SAVE.
Hope this helps.
The problem is that Jenkins causes confusion by reporting that the file is missing under /var/jenkins_home/
, which is a hard-coded value. Instead, it should be telling you that the file is missing under your actual $JENKINS_HOME
path. That way, you would immediately know where to look.
So the easiest way to fix this is to:
Go to the actual $JENKINS_HOME
directory on your Jenkins master, and create a .ssh
directory and known_hosts
file under it, for example:
$ mkdir $JENKINS_HOME/.ssh
$ touch $JENKINS_HOME/.ssh/known_hosts
If you've ever SSH-ed from Jenkins master to your slave machine before, then you should already have a known_hosts
file under your ~/.ssh
directory. If you don't, then SSH from Jenkins master to Jenkins slave machine and it will get automatically created for you under ~/.ssh
directory for that user.
Now open that ~/.ssh/known_hosts
file and simply copy>paste the line that contains your slave machine's IP address to the $JENKINS_HOME/.ssh/known_hosts
file. Alternative way is to copy the entire ~/.ssh/known_hosts
file to $JENKINS_HOME/.ssh
directory if that is easier for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With