March 8, 2017

How to reset password of Jenkins

Reset password of Jenkins

Prefer way, No securities were harmed


To reset it without disabling security if you're using matrix permissions (probably easily adaptable to other login methods):
  1. In config.xml, set disableSignup to false.
  2. Restart Jenkins.
  3. Go to the Jenkins web page and sign up with a new user.
  4. In config.xml, duplicate one of the <permission>hudson.model.Hudson.Administer:username</permission> lines and replace username with the new user.
  5. If it's a private server, set disableSignup back to true in config.xml.
  6. Restart Jenkins.
  7. Go to the Jenkins web page and log in as the new user.
  8. Reset the password of the original user.
  9. Log in as the original user.
Optional cleanup:
  1. Delete the new user.
  2. Delete the temporary <permission> line in config.xml.

Alternative way:


ssh to the server, disable authentication, set the password via the Jenkins Web UI, then enable authentication.

In configuration file of jenkins, for example: /var/lib/jenkins/config.xml

Change from:
<useSecurity>true</useSecurity>
to:

<useSecurity>false</useSecurity>
Comment out the authorizationStrategy block
<!--authorizationStrategy class="hudson.security.GlobalMatrixAuthorizationStrategy">
    <permission>hudson.model.Computer.Configure:i88ca</permission>
    ...
</authorizationStrategy-->
restart jenkins, such as:

# service jenkins restart
After changing the password from web UI, you need to change back the configuration and restart jenkins service.

Featured Post

Updated Coupons / promo codes for Google Apps for Work / Business

To redeem: 1. Sign up for Google Apps   2. Go to your billing settings  3. Choose your payment plan  4. Enter your promo code ...