Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure Jenkins for different user.home

I am running Jenkins version 1.527 (I know there is a newer version but it is broken, I can't use the user interface in 1.528 and haven't gotten a chance to upgrade to 1.529)

I am trying to change the user.home system property in Jenkins by doing this in my startup script:

export HOME=/new-home-dir

However, the environment variable shows correctly in jenkins and user.dir shows as the exported variable, but user.home does not change.

The reason I can't use the default functionality is because I am in an enterprise that locks down the user's home directory and my user can add or modify files there.

Any help on changing user.home would be greatly appreciated.

FYI - I am running Jenkins on RHEL v6.2

Attempted Solutions

  1. add -Duser.home=/newDir to JAVA_OPTS or JAVA_ARGS, neither worked
  2. add -Duser.home=/newDir to the MAVEN_OPTS in the build job.
like image 819
TheDevOpsGuru Avatar asked Sep 09 '13 18:09

TheDevOpsGuru


2 Answers

I found another workaroud.

  1. Go to the Manage Jenkins > Configure System
  2. Navigate to the Global Properties
  3. Make the Checkbox Environment variables active
  4. Name field pop up the user.home
  5. value is your desired path
  6. Click Apply, Save and Restart Jenkins

This overrides that path.

like image 67
Michal Avatar answered Oct 16 '22 09:10

Michal


I exactly had the same problem. You cannot just add an environment variable to change the path. You'll need to change the jenkins user's home directory itself.

In a linux/unix based system run the following command on your terminal.

login as a root user or use sudo in front of the commands if you're not running it as root user,

1) Move the Jenkins installation directory your desired location.

  mv /var/lib/jenkins /path/to/your/location

2) Change the Jenkins users home directory.

  usermod -d /path/to/your/location jenkins

Now restart jenkins. You should see the user.home and HOME variable set to the new location.

like image 3
Dinesh Avatar answered Oct 16 '22 09:10

Dinesh