Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Jenkins jobs on Linux under a User

Tags:

I have Jenkins installed in Linux and I want to run the build(s) under a user.

Not just a simple user, but one that belongs to the list of user that access the linux machine and that belongs to a certain group as it has privileges to modify/create files under a certain folder.

I have read somewhere that you can set the variable $JENKINS_USER but I do not know where and how. Thank you for your time

P.S. I did some research all the questions posted are similar but not the same as this one

Please if I am not clear read this: Usually Jenkins execute the build using a user called jenkins, now I want to be able to use a different user (pre-existing).

like image 810
7dr3am7 Avatar asked Jan 18 '12 12:01

7dr3am7


2 Answers

Yes, it is necessary to set JENKINS_USER variable, but in another file.

Look here http://blog.manula.org/2013/03/running-jenkins-under-different-user-in.html

like image 165
Gangnus Avatar answered Oct 12 '22 10:10

Gangnus


Have a look at the Started-By Environment Variable plugin.

https://wiki.jenkins-ci.org/display/JENKINS/Started-By+Environment+Variable+Plugin

EDIT:

If you are just asking how to set up Jenkins to run under a different user in Linux it depends on how you installed it. I never set up Jenkins on Linux yet (but I can use google). Have a look at https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins for different setup options. I had a look at Installing Jenkins as a Unix daemon and at step 7 you need to setup a configuration file. Change the last line in that file (RUN_AS_USER=jenkins) to contain the user of your choice.

like image 22
Peter Schuetze Avatar answered Oct 12 '22 08:10

Peter Schuetze