When managing user permissions, a user might set a permission wrong and lose access when using their main administrator account. Regaining access can be done in a few steps.
global security needs to be changed, unable to login as administrator
There are two methods you could follow to restore access:
Restore a backup of your previous security realm settings from before you changed it
Disable security entirely so you can re-configure your security realm
The preferred option is option 1, since you will be restoring your previous authentication settings. Option 2 which disables security entirely is dangerous if your instance is accessible to anyone else. The reason it is dangerous is because anyone who can access the controller when security is disabled can access all information on that controller, including secret credentials and all of your jobs. The second option should only be used when you isolate network access to the controller during the timeframe when security is disabled.
For option 1, which is restoring a backup of your previous security realm settings:
Stop the service.
JENKINS_HOME/config.xmlfrom the backup you took immediately before you changed the security realm. We recommmend you do a
diffof the current content of
JENKINS_HOME/config.xmland the version from the backup before you replace it, to ensure you understand what you are reverting.
Start the service.
For option 2, which is disabling security entirely so you can re-configure your security realm:
Edit the config.xml file in the
JENKINS_HOMEfolder and locate this line:
Set the value to
If you don’t know your
adminpassword when using
Jenkins’ own user databasefor your
Security Realm, go to
JENKINS_URL/user/admin/configureto set the new
Now go to
Configure Global Securityand choose your
Authorizationsettings to re-enable security.