November 15, 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

B&H has some good discounts on the entire Macbook range.

The 15.4-inch Macbook Pro (2016) model has $600 off, retailing at $1799, which is one the best I've seen so far. The higher spec Macbook...