Disable security in Jenkins to recover admin user

It might happen while configuring security realm / authorization, your admin account may be locked out and you are no longer able to reconfigure Jenkins.

When this happens, you can fix this by the following steps:

  1. Stop Jenkins (the easiest way to do this is to kill the servlet container.)
  2. Go to $JENKINS_HOME in the file system and find config.xml file.
  3. Open this file in the editor.
  4. Look for the false element in this file.
  5. Replace true with false
  6. Remove the elements authorizationStrategy and securityRealm
  7. Start Jenkins

When Jenkins comes back, it’s in the unsecured mode where everyone gets full access to the system. Now fix the issue and re-enable the elements for authorizationStrategy and securityRealm.

If this is still not working, trying renaming or deleting config.xml.

4 thoughts on “Disable security in Jenkins to recover admin user

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s