[英]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) 我正在运行Jenkins版本1.527(我知道有一个更新的版本,但它已损坏,我无法在1.528中使用用户界面,并且没有机会升级到1.529)
I am trying to change the user.home system property in Jenkins by doing this in my startup script: 我试图通过在我的启动脚本中执行此操作来更改Jenkins中的user.home系统属性:
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. 但是,环境变量在jenkins中正确显示,user.dir显示为导出变量,但user.home不会更改。
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. 任何有关更改user.home的帮助将不胜感激。
FYI - I am running Jenkins on RHEL v6.2 仅供参考 - 我在RHEL v6.2上运行Jenkins
Attempted Solutions 试图解决方案
I found another workaroud. 我找到了另一个workaroud。
This overrides that path. 这会覆盖该路径。
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.
您需要更改jenkins用户的主目录。
In a linux/unix based system run the following command on your terminal. 在基于linux / unix的系统中,在终端上运行以下命令。
login as a root user or use sudo in front of the commands if you're not running it as root user, 如果您没有以root用户身份运行,请以root用户身份登录或在命令前使用sudo,
1) Move the Jenkins installation directory your desired location. 1)将Jenkins安装目录移动到所需位置。
mv /var/lib/jenkins /path/to/your/location
2) Change the Jenkins users home directory. 2)更改Jenkins用户主目录。
usermod -d /path/to/your/location jenkins
Now restart jenkins. 现在重启jenkins。 You should see the user.home and HOME variable set to the new location.
您应该看到user.home和HOME变量设置为新位置。
I had the same problem and solved in two different ways: 我有同样的问题,并以两种不同的方式解决:
1- At the first time I edited the file startup.sh
, inside /tomcat/bin
. 1-我第一次编辑文件
startup.sh
,在/tomcat/bin
里面。 Inside this file I added this at the first line: JENKINS_HOME=/var/jenkins
在这个文件中我在第一行添加了这个:
JENKINS_HOME=/var/jenkins
2- Set the same inside environment variables. 2-设置相同的内部环境变量。 Just take care to set the variable with the same user that Jenkins are executed.
只需注意使用Jenkins执行的相同用户设置变量。 For example, if Jenkings Jenkins is running under root , you need to specify the environment variable with this uses.
例如,如果Jenkings Jenkins在root下运行,则需要使用此用法指定环境变量。
Observation: Because of compatibility questions, if you define HUDSON_HOME
instead of JENKINS_HOME
it will works fine two. 观察:由于兼容性问题,如果您定义
HUDSON_HOME
而不是JENKINS_HOME
,它将正常工作。
Hope it helps! 希望能帮助到你!
I exactly had a same problem on ubuntu server. 我在ubuntu服务器上遇到了同样的问题。
login as a root user. 以root用户身份登录。
stop the all process running with a jenkins user. 停止使用jenkins用户运行的所有进程。
1) stop the jenkins service. 1)停止詹金斯服务。
sudo service jenkins stop
2) Change the Jenkins users home directory. 2)更改Jenkins用户主目录。
usermod -d /path/to/your/location jenkins
3) start the jenkins service. 3)启动jenkins服务。
sudo service jenkins start
You will see the user.home and HOME and PWD variable set to the new location. 您将看到user.home和HOME和PWD变量设置为新位置。
Go to: Manage Jenkins > system information 转到:管理Jenkins>系统信息
Here you will see the changed variables location 在这里,您将看到更改的变量位置
Changing JENKINS_HOME and user.home are two separate topics. 更改JENKINS_HOME和user.home是两个独立的主题。 The original questions is all about changing the user.home system property.
最初的问题是关于更改user.home系统属性。 I resolved this issue (in Jenkins 2.34) by following the steps mentioned below:
我按照下面提到的步骤解决了这个问题(在Jenkins 2.34中):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.