Changing the user running the Jenkins process

I wonder how to change the user starting the jenkins server on my ubuntu.

In the http://[server]:8080/systemInfo page, I can find the environment variable: USER jenkins

My motivation is to set the user 'git' to rotate the jenkins failure to clone the git project hosted by the user 'git' on the same computer:

 hudson.plugins.git.GitException: Command "git clone --progress -o origin ssh:// git@ [server]:22/~/[repo].git /var/lib/jenkins/workspace/[project]" returned status code 128: stdout: Cloning into /var/lib/jenkins/workspace/[project]... stderr: Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,password) 

... after generating ssh keys for the jenkins user and checking the exact settings in Jenkins SSH settings.

Thanks for the help!

+4
source share
1 answer

I do not think that changing the user Jenkins is working with is a solution.

You must log in to your Ubuntu field as a Jenkins user (or sudo su - jenkins to it), and then verify that ssh git@ [your-git-server] working correctly. Most likely, there is no SSH key or permission problem with one of the files or directories associated with the SSH key.

Either this or the git command line tools do not recognize SSH keys configured from Jenkins. I know they work when I have a jenkins user with a valid ~jenkins/.ssh/id_rsa and a valid entry in ~jenkins/.ssh/known_hosts .

+3
source

Source: https://habr.com/ru/post/1412056/


All Articles