Jenkins is an open source automation server which can be used to automate tasks related to building, testing, and deploying software. There are times when you may need to reset the Jenkins admin password if you have lost or forgotten it. Here we will learn how to reset the Jenkins admin password in a few simple steps.
Jenkins should be successfully installed on your machine before doing these steps. If you have installed Jenkins using war file then you will find Jenkins home directory in C:\Users\User\.jenkins folder. But if you have installed Jenkins using exe file then you will find Jenkins home directory in Program files. Under .jenkins folder , you will find cofig.xml file.
Open it using notepad or notepad++.Here the tag userSecurity is true which means Jenkins will ask for the credentials for login.
As we have forgot the username and password, we will make it false and save the file.
Now restart your Jenkins again and you should receive message Jenkins is fully up and running.
Now go to the localhost:8080 and hit enter, you should see the below screen but here you cannot see any login as we have disabled it above by changing userSecurity tag to false .
Under Manage Jenkins go to Configure global security. Now change security realm to Jenkin's own user database and click save button.
Now go back to dashboard and click on people. Select the user for whom you have to change password.
Click on configure and under password section, change the password for the selected user and save changes.
Now click on Sign in button and try to login with new password for the username you have reset just now. You should get successfully logged in and your name should be displayed near logout button on top right corner.
So you have successfully reset your Username and password for Jenkins with above steps.