Jenkins is an open-source tool that allows developers to build, test and deploy using a sequence of steps. In this answer, we'll learn how to enable security and create logins in Jenkins.
Start Jenkins server. By default, the server runs on port 8080.
Once Jenkins is opened in the browser, click the "Manage Jenkins" button.
Now click on the "Configure Global Security" button:
Select "Enable security", which enables authentication and authorization in Jenkins.
In the "Security Realm" section, select "Jenkins own user database".
Select the "Authorization" section according to the requirement. Here, we select "Logged-in users can do anything".
Now click on "Apply" and save.
We have enabled the security. Now, let's create users/logins. Now go back to the homepage and click on "Manage Jenkins" again to create users.
Click on the "Manage Users" button:
Click on the "Create User" button:
A form will be displayed to fill with user details. After filling out the form, click on "Create User" button. Here, we created a user/login with the username "test_user".
Next, log in to Jenkins with the new user "test_user" we just created:
Once logged in, we can see the current logged-in user name at the top right corner of the UI.
We have now enabled security and created users/logins in Jenkins.
By enabling security we can control accessing the Jenkins pipeline only by the authenticated users. We can even control what actions each user can perform using the matrix-based security in the authorization. We may not want every logged-in user can do admin operations. This process helps us to protect Jenkins from unwanted and unauthorized actions.
We have learned to enable security and create logins in Jenkins step by step. We have different options available in the authorization. We need to use them according to the requirement to control what level of access we can give to logins/users.
Free Resources