Skip to content

Instantly share code, notes, and snippets.

@gmhawash
Created November 9, 2012 01:54
  • Star 56 You must be signed in to star a gist
  • Fork 19 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gmhawash/4043232 to your computer and use it in GitHub Desktop.
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'
@rishabh6788
Copy link

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

@devopsyuva
Copy link

devopsyuva 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)

@zeeshan-github-project
Copy link

zeeshan-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
Copy link

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