Written by 5:05 am Automation, CICD • 9,028 Comments

How to Reset Jenkins Admin users Password

In this blog today i am going to explain how to reset Admin password of Jenkins instance. (Create new Admin user in Jenkins instance) .

Now a days I am focusing more on CICD activities. I faced this issue last week. I created my new Jenkins instance.  Also added some pipelines in it. But after gap of few days I lost my admin password of Jenkins instance. While preparing one demo I sensed I have lost my Jenkins instance credentials.  That time I got upset and did lots of search and reset my admin password.

I am sharing my experience with you here. How to reset ADMIN password of Jenkins instance. For ref this my Jenkins instance.

  1. First step is taking SSH into Jenkins virtual machine (Here In example I am using Linux).
  2. Once you are logged in successfully into Jenkins VM (Virtual Machine). Go to directory ‘Jenkins’ and open file ‘config.xml’ .
  3. Use command – “ $ sudo vi /var/lib/Jenkins/config.xml file. “

4. This command will open config.xml file as below:

5. Go to <useSecurity> tag and check value, it will be true.

6. Click ‘ i ’ so it file will be in insert mode.  Then you can update the file. You need to update <useSecurity> tag value to ‘false‘ as below.

7. Save this file and exit from file.  Use commands (  ‘ :wq! ‘ – to save updated file )

8. Once you are done with updating value in config.xml file. Restart Jenkins service. Use command (‘ $ sudo systemctl restart Jenkins ‘)

9. After restart Jenkins services , make user its status is ‘active {running}’. Use command (‘ sudo systemctl status jenkins ‘). As shown        above.

10. Now open Jenkins URL. It will go to dashboard direct. No any credentials required. You can see after opening dashboard ‘Logged in user’ section will be blank. As it is now Anonymous user.

11. Now, Delete old admin users. To do that go to People option in left hand side bar.

12. Here you will get all list of users including your admin user. Open that ‘’Admin” user and delete it as shown below.

13. Now once you deleted old admin user. To reset all security options, go to “ Jenkins -> Manage Jenkins “ option in left hand side option lists.

14. Go to  “Configure Global Security” option

15. You will see all option as bellow, do all below mentioned changes on this page

  •  Enable ‘Enable Security’ option.  (Tick)
  • In Security Realm Option Select “Jenkins own database” option.
  • Unselect / Untick “Allow users to sign up” option under “Jenkins own database” option.

16. In Authorization section do following changes :

  • Select “Logged-in users can do anything” option (Tick).
  • Unselect / Untick “Allow anonymous read access” option under “Logged-in users can do anything” option.
  • Click Save button.

17. You will be redirected to “Create First Admin User” page once you click on “Save” button.

18. Add new admin user details here. You can put any user name and password. Put full name and email ID for reference. The click on “Create First Admin User”

19. Once you fill all the details, click on “Create First Admin User” button. ( Here we are asking to update password on existing admin user , so you can keep admin user name same as it was previously. Thus only password will be new. )

20. You will be ready with new Admin users to login again into Jenkins portal.

Here is your Dashboard and you are logged into Jenkins with new admin user. Hurry…. !

(Visited 11 times, 1 visits today)
Close