Create and Manage Users in Jenkins
Generally, in a large organization, there are multiple separate teams to run and manage jobs in Jenkins. But managing this crowd of users and assigning roles to them is too difficult.
By default, when you create a user in Jenkins, it can access almost everything. In this, you can create multiple users but can only assign the same global roles and privileges to them. This is not ideal, especially for large organizations.
To enable you to assign different roles and privileges to different users in Jenkins, you should have to install the Role Strategy Plugin.
Install Role-based Authorization Strategy Plugin
Step 1: Open your Jenkins dashboard by visiting http://localhost:8080/jenkins
Steps 2: Click on 'Manage Jenkins' and select the 'Available' tab.
Step 3: On the filter option, type "role-based" and press Enter.
Step 4: Now, select the plugin and click on 'Install without restart' button.
Step 5: Click on 'Go back to the top page'.
Enable Role-Based Strategy on Jenkins
Step 1: After Plugin installation, go to the 'Manage Jenkins' and then click on 'Configure Global Security'.
When you click the Configure Global Security option then you will see the following page:
Check on Enable security option.
Step 2: On the Security Realm section, select 'jenkins' own user database'.
Click on Save.
Step 3: You will be prompted to add your first user. Here, we are setting up an admin user for the system.
Click on Create First Admin User.
Creating User on Jenkins
Step 1: Now it's time to setup your users in the system. When you go to manage Jenkins and scroll down, you will see the 'Manage Users' option. Click on this option.
Step 2: Just Like, you defined the admin user, and start creating other users for the system. Let's create another user:
Managing User Roles on Jenkins
Step 2: Click on Manage Roles option to add new roles.
Step 2: To create a new role called "developer".
Assigning User Roles on Jenkins
Step 1: Now, you have created roles, let's assign them to specific users.
Step 2: Let's add new role "developer" to user.