Can I create Roles in Jenkins server and assign to users?. The answer to this question is “Yes“. Jenkins is the leading open source automation server known to DevOps. Through hundreds of Plugins at your disposal, you can extend its features set to achieve ultimate building, automation, and deployment of any project.

How to manage users and roles in Jenkins

By default, when you create a user in Jenkins, it can access almost everything. In this guide, we will cover how you can create fine-grained roles for proper access control to Jenkins Server. We will use Roles Strategy Plugin to achieve this.

You need a running Jenkins Server to use this guide. If you stepped on this page while doing research work, below are the guides to help with installation of Jenkins server.

How to install Jenkins on CentOS 7

Running Jenkins Server in Docker Container with Systemd

How to Install and Configure Jenkins on Arch Linux

How to Install Jenkins on Ubuntu

Once Jenkins is live, login with the admin user account and navigate to Jenkins > Manage Jenkins > Manage Plugins > Available > Filter.

jenkins users roles 01

Type “Role-based Authorization Strategy” in the filter box and hit enter.

jenkins users roles 02

Select plugin and click the “Download now and install after restart“.

jenkins users roles 04

Restart Jenkins by clicking on check box.

Enable Role-Based Strategy on Jenkins

After plugin installation, navigate to “Jenkins > Configure Global Security“. Tick Enable security and Role-Based Strategy then save settings.

jenkins users roles 05

Creating User Roles on Jenkins

Go to “Jenkins >  Manage and Assign Roles > Manage Roles“.

jenkins users roles 06
jenkins users roles 07

Provide role name to create on Role to add and click ‘Add“.

jenkins users roles 08

Tick appropriate values for your new role, in my case, I’m creating view only user so it will have.

  • Read under Overall
  • All under View
jenkins users roles 09

You can also create “Project roles” which will work for all projects with that matches specified pattern.

jenkins users roles 10
jenkins users roles 11

Slave roles can also be created in a similar way.

Assign roles to users

Go to “Jenkins >  Manage and Assign Roles > Assign Roles“.

Login as user with assigned role. Only projects granted should be visible.

jenkins users roles 15

For any new user created without being assigned a role, access denied message should be shown.

jenkins users roles 16

If you want to learn more about Jenkins Administration checkout below recommended on-demand video course.

Recommended Udemy Courses To Learn Jenkins:

Subscribe to our Newsletter to receive updates on all new posts.

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here