Reputation: 14504
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.
Upvotes: 23
Views: 43546
Reputation: 261
A very simple step helped me to recover this error.
In Slave configuration, select "No verifying verification strategy" for Host Key Verification Strategy. This will allow master to connect with slave and host will also be remembered.
Next time on selecting "Known host file verification strategy" will not give this error.
Upvotes: -3
Reputation: 1099
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.
Upvotes: 6
Reputation: 482
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.
Upvotes: 44