1

I am using Centos 7. I have Jenkins installed on it

I have copied ~/.ssh directory to /var/lib/jenkins/

Contents of .ssh directory are

  1. authorized_keys
  2. id_rsa
  3. id_rsa.pub
  4. known_hosts

Now when I am trying to Launch slave it is still giving error .

[SSH] Opening SSH connection to :22.
/var/lib/jenkins/.ssh/known_hosts [SSH] No Known Hosts file was found at 
/var/lib/jenkins/.ssh/known_hosts. 
Please ensure one is created at this path and that Jenkins can read it.

This is how slave configuration looks like

enter image description here

1

Your known_hosts file needs to be readable by the Jenkins user and mode 600.

As the error message says (emphasis mine):

Please ensure [the known hosts file] is created at this path and that Jenkins can read it.

Assuming your Jenkins user is jenkins, here is how to ensure the contents of Jenkins' SSH directory have the right permissions:

sudo chown -Rh jenkins:jenkins /var/lib/jenkins/.ssh
sudo chmod 600 /var/lib/jenkins/.ssh/{authorized_keys,id_rsa,known_hosts}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.