linux Jenkins 运行账号修改

Aug 16, 2016

安装 jenkins后碰到 自动部署系统的运行(tomcat)用户跟jenkins的运行用户不同,导致运行时权限冲突。有两个方案,修改运行时系统的用户,或者修改jenkins的用户,本文针对后者,修改jenkins运行用户。

编辑 配置文件 /etc/sysconfig/jenkins ,

#

Unix user account that runs the Jenkins daemon

Be careful when you change this, as you need to update

Be careful when you change this, as you need to update

permissions of $JENKINS_HOME and /var/log/jenkins.

# JENKINS_USER=”dev” #

配置为想要修改的 用户名,同时修改  $JENKINS_HOME(默认是 /var/lib/jenkins)  /var/log/jenkins 两个目录的权限

首先停掉 jenkins

#service jenkins stop #chown -R dev /var/log/jenkins #chown -R dev /var/lib/jenkins

这样就差不多了,启动查看日志文件  /var/log/jenkins/jenkins.log 是否有错误。

提示 #java.io.FileNotFoundException: /var/cache/jenkins/war/META-INF/MANIFEST.MF (权限不够)#

修改 /var/cache/jenkins 文件的权限  重新启动, 一切OK!