Skip to content

Instantly share code, notes, and snippets.

@lioneltchami
Created July 25, 2022 09:06
Show Gist options
  • Select an option

  • Save lioneltchami/4fea1d013d0a73a361d5df86152ebef7 to your computer and use it in GitHub Desktop.

Select an option

Save lioneltchami/4fea1d013d0a73a361d5df86152ebef7 to your computer and use it in GitHub Desktop.
RUN JENKINS AS NON-ROOT USER
First, Open “/etc/sysconfig/jenkins” file. Changing JENKINS_USER variable and Make sure user exists in your system.
The default, JENKINS_USER is Jenkins USER as below
[root@Devops ~]# cat /etc/sysconfig/jenkins | grep JENKINS_USER
JENKINS_USER="jenkins"
Changing JENKINS_USER to huupv USER.
[root@Devops ~]# sed -i -e 's/JENKINS_USER\="jenkins"/JENKINS_USER\="huupv"/g' /etc/sysconfig/jenkins
The screen output terminal:
[root@Devopss ~]# cat /etc/sysconfig/jenkins | grep JENKINS_USER
JENKINS_USER="huupv"
The changing ownership Jenkins home
[root@Devops ~]# chown -R huupv:huupv /var/lib/jenkins
[root@Devops ~]# chown -R huupv:huupv /var/cache/jenkins
[root@Devops ~]# chown -R huupv:huupv /var/log/jenkins
The restarted Jenkins and check user has changed with ps command.
[root@Devops ~]# /etc/init.d/jenkins restart
[root@Devops ~]# ps -ef | grep jenkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment