Jenkins

How To Manage Users and Roles in Jenkins

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.

Original content from computingforgeeks.com - post 9536

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.

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

Enjoy using Jenkins!

Related Articles

Kubernetes How to force delete a Kubernetes Namespace Automation How To Provision Virtual Machines on KVM with Terraform Ansible Automate Linux Systems with Ansible System Roles Automation How Automation Is Changing Airports – And What’s Coming Next

Leave a Comment

Press ESC to close