Jenkins is a popular open-source automation server that is widely used for continuous integration and continuous delivery (CI/CD) in software development. As a system administrator, you may need to reset the Jenkins admin password if you have lost or forgotten it.
In this tutorial, we will learn how to reset the Jenkins admin password in a few simple steps.
Steps to Reset Jenkins Admin Password
Follow the below steps to recover admin account access to the Jenkins portal.
- Disable Current Security – First of all, login to your Jenkins server and edit the Jenkins configuration file (/var/lib/jenkins/config.xml) in your favorite text editor:
sudo vim /var/lib/jenkins/config.xml
Disable the security by changing the
`useSecurity`tag value to “false”.
Save your file and close it. The vim users press the
`ESC`button then type
`:wq!`and hit Enter to save the file.
- Apply Changes – Restart Jenkins service to apply the changes.
sudo systemctl restart jenkins
After restarting make sure the Jenkins service is running with
`sudo systemctl status jenkins`command.
- Access Jenkins as Anonymous User – Again access Jenkins in a web browser, It will redirect you to the dashboard without prompting for authentication. You will be logged in as an anonymous user to Jenkins.
- Under the Dashboard, go to the
`People`option as seen in below image:
- Delete Admin Account – Select the Admin user account to delete. Then click the
"Delete"button to detele the selected account:
"Yes"to confirm the account deletion.
- Enable Security Again – Now once you deleted old admin user. To reset all security options, go to the
“Manage Jenkins”option in left-hand side option lists. Now click on the “Configure Global Security” option
You will see all option as bellow, do all below mentioned changes on this page
- Enable the “Enable Security” option.
- In Security Realm option select “Jenkins own database”
- Make sure to uncheck the “Allow users to sign up” option under the “Jenkins own database” option.
- Save Changes – Save all changes made above.
- Create Admin Account – You will be redirected to “Create First Admin User”. Input all required details to create a new Admin account.
- Login as New Admin User – Now, you can access your Jenkins dashboard using the newly created Admin account.
- All Done
In this tutorial, we learned how to reset the Jenkins admin password in a few simple steps. We hope that this tutorial has helped you understand how to reset the Jenkins admin password and that you are now able to access your Jenkins instance. If you have any questions or need further assistance, please don’t hesitate to ask.