7dr3am7 7dr3am7 - 3 years ago 166
Linux Question

Run Jenkins jobs on Linux under a User

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).

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download