Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Reset jenkins password
0. SSH to server
1. Edit /opt/bitnami/apps/jenkins/jenkins_home/config.xml
2. set userSecurity to false: <userSecurity>false</userSecurity>
3. delete
<authorizationStrategy> and <securityRealm>
4. /etc/init.d/bitnami restart
Now Jenkins should be open:
5. Select Configure Jenkins,
"Enable Security",
"Use Jenkin's own database"
"Allow users to sign up"
6. Under Authorization, select: "Matrix-based security"
and add users and give them all permissions,
and remove all permissions from 'anonymous'
@gmhawash

This comment has been minimized.

Copy link
Owner Author

@gmhawash gmhawash commented Nov 20, 2012

To Reset individual password:

  1. Go to /opt/bitnami/apps/jenkins/jenkins_home/users/gmhawash
  2. Edit config.xml file
  3. Remove the passwordHash tag (you can now log in without password)
@amertkara

This comment has been minimized.

Copy link

@amertkara amertkara commented Jun 11, 2014

To reset individual passwords, you can also remove the user folder completely (or rename for backing up) and then create a new user with the same username. This way, you preserve your permissions.

@zetachang

This comment has been minimized.

Copy link

@zetachang zetachang commented Oct 13, 2014

This just save my life, thanks! 👍

@kerspoon

This comment has been minimized.

Copy link

@kerspoon kerspoon commented Mar 11, 2015

It was slightly different for me:

cd /var/lib/jenkins/
nano config.xml 
service jenkins restart
@nevros

This comment has been minimized.

Copy link

@nevros nevros commented Apr 6, 2015

@chanjetsdp

This comment has been minimized.

Copy link

@chanjetsdp chanjetsdp commented Sep 5, 2016

refer:
http://stackoverflow.com/questions/6988849/reset-jenkins-configuration-command-line
One other way would be to manually edit the configuration file for your user (e.g. /var/lib/jenkins/users/username/config.xml) and update the contents of passwordHash:

#jbcrypt:$2a$10$razd3L1aXndFfBNHO95aj.IVrFydsxkcQCcLmujmFQzll3hcUrY7S
Once you have done this, just restart Jenkins and log in using this password:
test

@mhicauber

This comment has been minimized.

Copy link

@mhicauber mhicauber commented Sep 20, 2016

@chanjetsdp thanks your method is really nice. Simply removing the hash from the user's config file led me to errors once logged in, whereas your solution just work.

@daithimorton

This comment has been minimized.

Copy link

@daithimorton daithimorton commented Sep 29, 2016

+1

@ablaye

This comment has been minimized.

Copy link

@ablaye ablaye commented Oct 3, 2016

+1

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Feb 9, 2017

@chanjetsdp thank you! Very very much!

@premkash

This comment has been minimized.

Copy link

@premkash premkash commented Apr 10, 2017

@boga5

This comment has been minimized.

Copy link

@boga5 boga5 commented Jul 27, 2017

@gmhawash This method works. I changed it accordingly for Ubuntu.
Thanks for sharing :)

@JasperLab

This comment has been minimized.

Copy link

@JasperLab JasperLab commented Aug 4, 2017

@chanjetsdp, thank you!

@mvn86

This comment has been minimized.

Copy link

@mvn86 mvn86 commented Aug 7, 2017

@chanjetsdp, thank you!

@ansshriv

This comment has been minimized.

Copy link

@ansshriv ansshriv commented Aug 17, 2017

@chanjetsdp- Thanks - it perfectly works.

@beeva-martasanchez

This comment has been minimized.

Copy link

@beeva-martasanchez beeva-martasanchez commented Sep 20, 2017

+1

@zabih-alipour

This comment has been minimized.

Copy link

@zabih-alipour zabih-alipour commented Oct 30, 2017

+1

@Tenmak

This comment has been minimized.

Copy link

@Tenmak Tenmak commented Dec 1, 2017

@chanjetsdp Simple and efficient. Thanks.

@satspeedy

This comment has been minimized.

Copy link

@satspeedy satspeedy commented Dec 24, 2017

+1

@dubareddy

This comment has been minimized.

Copy link

@dubareddy dubareddy commented Jan 9, 2018

awesome.... +1

@som3ah01

This comment has been minimized.

Copy link

@som3ah01 som3ah01 commented May 5, 2018

1 first check location if you install war or Linux or windows based on that

for example if war under Linux and for admin user

/home/"User_NAME"/.jenkins/users/admin/config.xml

go to this tag after #jbcrypt:

<passwordHash>#jbcrypt:$2a$10$3DzCGLQr2oYXtcot4o0rB.wYi5kth6e45tcPpRFsuYqzLZfn1pcWK</passwordHash>

change this password using use any website for bcrypt hash generator

https://www.dailycred.com/article/bcrypt-calculator

make sure it start with $2a cause this one jenkens uses it

@shindesavita87

This comment has been minimized.

Copy link

@shindesavita87 shindesavita87 commented Jul 6, 2019

To reset individual passwords, you can also remove the user folder completely (or rename for backing up) and then create a new user with the same username. This way, you preserve your permissions.

This solution worked for me. Thanks.
However, the downside of this is you will lose all the work you did so far. Like all installed plugin, all created job, all done settings...

@rishabh6788

This comment has been minimized.

Copy link

@rishabh6788 rishabh6788 commented Sep 16, 2019

refer:
http://stackoverflow.com/questions/6988849/reset-jenkins-configuration-command-line
One other way would be to manually edit the configuration file for your user (e.g. /var/lib/jenkins/users/username/config.xml) and update the contents of passwordHash:

#jbcrypt:$2a$10$razd3L1aXndFfBNHO95aj.IVrFydsxkcQCcLmujmFQzll3hcUrY7S
Once you have done this, just restart Jenkins and log in using this password:
test

+1. worked like a charm

@dubareddy

This comment has been minimized.

Copy link

@dubareddy dubareddy commented Sep 3, 2020

If you are using Ubuntu 16.04+

Install package --> apt install apache2-utils
After successful installation of the package, execute the below command:

root@localaquaserver:# htpasswd -nbBC 10 admin test123
admin:$2y$10$L76tVpxoxtB.TKB470PmzeFLFivZI8BdRyFv9qMgK9t5dxElnscF6
root@localaquaserver:
#

Now add above bcrypt password in config.xml file under default: /var/jenkins_home/ (Container with Image jenkins/jenkins:lts)

Restart Jenkins (based on platform)

@shan-github-project

This comment has been minimized.

Copy link

@shan-github-project shan-github-project commented Feb 2, 2021

1 first check location if you install war or Linux or windows based on that

for example if war under Linux and for admin user

/home/"User_NAME"/.jenkins/users/admin/config.xml

go to this tag after #jbcrypt:

<passwordHash>#jbcrypt:$2a$10$3DzCGLQr2oYXtcot4o0rB.wYi5kth6e45tcPpRFsuYqzLZfn1pcWK</passwordHash>

change this password using use any website for bcrypt hash generator

https://www.dailycred.com/article/bcrypt-calculator

make sure it start with $2a cause this one jenkens uses it

it worked for me

@armandomiani

This comment has been minimized.

Copy link

@armandomiani armandomiani commented Mar 16, 2021

refer:
http://stackoverflow.com/questions/6988849/reset-jenkins-configuration-command-line
One other way would be to manually edit the configuration file for your user (e.g. /var/lib/jenkins/users/username/config.xml) and update the contents of passwordHash:

#jbcrypt:$2a$10$razd3L1aXndFfBNHO95aj.IVrFydsxkcQCcLmujmFQzll3hcUrY7S
Once you have done this, just restart Jenkins and log in using this password:
test

👍 worked fine! But... do you happen to know how this string is formed? :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment