-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
running version 2.475-jdk17 docker image, I am unable to have jenkins find the known_hosts file.
The $JENKINS_HOME directory is /var/jenkins_home.
I've created the .ssh directory in $JENKINS_HOME, set permissions both 644 and 600 on separate occasions.
The permissions of the known__hosts file are 644. The owner of both the .ssh directory and known hosts file are jenkins. Jenkins is running as user jenkins
With the git host key verification set to known hosts, I am getting the following error:
`You're using 'known hosts file' strategy to verify ssh host keys, but your known_hosts file does not exist, please go to 'Manage Jenkins' -> 'Security' -> Git Host Key...' and configure host key verification`.
If I manually enter the hosts, everything is just fine and the warning go away. This makes me kinda sad
There must be a mistake in some part of your steps to either create or use that known_hosts file. I am able to use the known hosts method with the following Dockerfile:
I built the container image with the command:
I run the container image with the command:
Once it is running, I complete the setup wizard by creating an account and installing the git plugin, the folders plugin, and the Pipeline plugins. Then I use "Manage" -> "Security" to configure host key recognition to use known hosts. I create an ssh private key credential and use it a a job definition that clones a private repository with ssh.
The known_hosts file must exist on both the controller and the agent. It must be in the correct location on both the controller and the agent. It must have the correct permissions on both the controller and the agent.