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.

Advertisement

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.

  1. 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.

  2. 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.

  3. 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.
  4. Under the Dashboard, go to the `People` option as seen in below image:
    How to Reset Jenkins Admin Password
    Click “People” button
  5. Delete Admin Account – Select the Admin user account to delete. Then click the "Delete" button to detele the selected account:
    Delete admin account

    Click "Yes" to confirm the account deletion.

    Confirm delete account
  6. Enable Security Again – Now once you deleted old admin user. To reset all security options, go to the “Jenkins” -> “Manage Jenkins” option in left-hand side option lists. Now click on the “Configure Global Security” option
    Go to 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.
    • Select “Jenkin’s own user database”

      And

      Logged in users can do anything

  7. Save Changes – Save all changes made above.
  8. Create Admin Account – You will be redirected to “Create First Admin User”. Input all required details to create a new Admin account.

    Create a New Admin User in Jenkins

  9. Login as New Admin User – Now, you can access your Jenkins dashboard using the newly created Admin account.

    Login Jenkins Admin Dashboard

  10. All Done

Conclusion

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.

Share.

2 Comments

  1. Hi Team
    this document is good, but you made one error you have written ‘userSecurity’ but is it useSecurity. Which is correctly showing in screenshot. If possible, get this change

Leave A Reply

Exit mobile version