Pages

Saturday, December 26, 2015

Run Jenkins with different username

There are cases when running Jenkins, we see "Permission Denied" Errors. When running with a jenkins user , it can throw permission issues when creating the files like war or tar after build. This article tells us how to run  the Jenkins with a system user,

1) Change the user name in the jenkins Configuration file /etc/sysconfig/jenkins. Change the user name value for the variable $JENKINS_USER in this files. Add the new name with which you want to run the jenkins

$JENKINS_USER="root"

2) Once the user is changed, we need to change the permission for the new user on the jenkins data directories like home, webroot and logs

chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins

Then restarted the Jenkins jenkins and check the user has changed using a ps command

/etc/init.d/jenkins restart

ps -ef | grep jenkins

No comments :

Post a Comment