How to Create/Add Users in Jenkins & Manage Permissions

Generally, in a large organization, there are multiple, separate teams to manage and run jobs in Jenkins. But managing this crowd of users and assigning roles to them can prove troublesome.

By default, Jenkins comes with very basic user creation options. You can create multiple users but can only assign the same global roles and privileges to them. This not ideal, especially for a large organization.

The Role Strategy Plugin enable you to assign different roles and privileges to different users. You will first need to install the plugin in your Jenkins mange environment.

In this Jenkins tutorial, you will learn

How to Create/Add a User in Jenkins

Below are the steps to create new user in Jenkins:

Step 1) Login to Jenkins Dashboard

Login to your Jenkins dashboard by visiting http://localhost:8080/

If you haven’t installed Jenkins in your local server, go to the appropriate URL and access your dashboard by using your login credentials.

Step 2) Choose the option

You will now see options to create and add user in Jenkins and manage current users.

Step 3) Create a new User

  • Under Manage Jenkins, Click Create User
  • Enter Jenkins add user details like password, name, email etc.
  • Click Create User

Step 4) User is created

You will see on the dashboard that a new Jenkins create user as per the details entered.

How to Install Role Strategy Plugin in Jenkins

There are two methods for installing plugins in Jenkins:

  1. Installing it through your Jenkins dashboard
  2. Downloading the plugin from Jenkins website and installing it manually.

Step 1)

1. Go to Manage Jenkins

2. Click on the Manage Plugins option

Step 2)

  1. In available section, screen Search for “role”.
  2. Select Role-based Authorization Strategy plugin
  3. Click on “Install without restart” (make sure you have an active internet connection)

Step 3)

Once the plugin is installed, a “success” status will be displayed.

Click on Go back to the top page.

Step 4) Go to Manage Jenkins -> Configure Global Security -> Under Authorization, select Role Based Strategy. Click on Save.

How to Manage Users and Roles in Jenkins

Following are the steps on how to manage and assign roles in Jenkins:

Step 1)

1. Go to Manage Jenkins

2. Select Manage and Assign Roles

Note: that the Manage and Assign Roles option will only be visible if you’ve installed the role strategy plugin.

Step 2) Click on Manage Roles to add new roles based on your organization.

Step 3) To create a new role called “developer”,

  1. Type “developer” under “role”.
  2. Click on “Add” to create a new role.
  3. Now, select the Jenkins user permissions you want to assign to the “Developer” role.
  4. Click Save

How to Assign Roles in Jenkins

Step 1) Now that you have created roles, let us assign them to specific users.

  1. Go to Manage Jenkins
  2. Select Manage and Assign Roles

Step 2) We shall add the new role “developer” to user “guru99

  1. Selector developer role checkbox
  2. Click Save

You can assign any role to any user, as per your need.

How to Create Project Roles in Jenkins

You can create project specific roles under Project Roles.

Step 1) In Jenkin’s Manage and Assign Roles

  1. Enter a role as “tester”
  2. Add a pattern to this by adding tester.*, so that any username starting with “tester” will be assigned the project role you specify.
  3. Click Add
  4. Select privileges
  5. Click Save