Skip to main content

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.

Popular posts from this blog

How to Remove / Hide "Powered by Blogger" (Attribution Gadget)

Settings -> Template -> Edit HTML -> Jump to widget: choose Attribution1

Change it to:

<b:widget id='Attribution1' locked='false' mobile='no' title='' type='Attribution'/>

Go to Layout, remove Attribution1 widget.

To hide: Template -> Customize ->  Advanced -> Add CSS - Paste the following code  -> Apply to Blog:
#Attribution1 { display: none!important; }