Wednesday, May 28, 2014

Running jenkins as a different user than "jenkins" for added security

On your EC2 instance if you have installed jenkins using pkg manager, then it possible to run jenkins process as a lesser privileged linux user other than "jenkins". You have to make the following changes in the system


  • Make the lesser privileged user own /var/lib/jenkins folder

$sudo chown -R <user>:<user> /var/lib/jenkins


  • Make the lesser privileged user own the jenkins logs folder so that is can write logs to it.
$sudo chown -R <user>:<user> /var/log/jenkins

  • Make the lesser privileged user own jenkins cache folder where the "war" is located
$sudo chown -R tdo:tdo /var/cache/jenkins

  • Edit sysconfig for jenkins in /etc/sysconfig/jenkins and edit JENKINS_USER="<user>"
  • Restart "jenkins" service
$sudo service jenkins restart
  • Confirm the process started successfully using "ps -ef |grep jenkins"




No comments:

Post a Comment