Jenkins run as non root user

In this tutorial, How do I Jenkins run as a non-root user in Linux? Jenkins the essential for DevOps Roles.

Jenkins run as a non-root user

To change the Jenkins user, 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@DevopsRoles ~]# cat /etc/sysconfig/jenkins | grep JENKINS_USER

Changing JENKINS_USER to huupv USER.

[root@DevopsRoles ~]# sed -i -e 's/JENKINS_USER\="jenkins"/JENKINS_USER\="huupv"/g' /etc/sysconfig/jenkins

The screen output terminal:

[root@DevopsRoles ~]# cat /etc/sysconfig/jenkins | grep JENKINS_USER

The changing ownership Jenkins home

[root@DevopsRoles ~]# chown -R huupv:huupv /var/lib/jenkins 
[root@DevopsRoles ~]# chown -R huupv:huupv /var/cache/jenkins
[root@DevopsRoles ~]# chown -R huupv:huupv /var/log/jenkins

The restarted Jenkins and check user has changed with ps command.

[root@DevopsRoles ~]# /etc/init.d/jenkins restart
[root@DevopsRoles ~]# ps -ef | grep jenkins

The screen output terminal:

Jenkins run as non root user


Thought the article, you can use Jenkins run as the non-root user as above. I hope will this your helpful.

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

2 thoughts on “Jenkins run as non root user

  1. Dear Sir,

    I followd your steps jenkins service run using non root user,’
    I am unable to stop/start jenkins services using non root user id ec2-user. But i can deploy package etc.

    Only root user allow me stop/start jenkins services. Any suggestion how to stop/start jenkins services using non root user .

    Please advise.

    [ec2-user@ip-10-0-1-12 sysconfig]$ service jenkins start

    Starting Jenkins runuser: may not be used by non-root users


Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.