Cannot restore Jenkins security after disabling it in config.xml

hudson, jenkins

Solution

    <hudson>
      <disabledAdministrativeMonitors/>
      <version>2.130</version>
      <numExecutors>2</numExecutors>
      <mode>NORMAL</mode>
      <useSecurity>true</useSecurity>
      <authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy">
        <denyAnonymousReadAccess>true</denyAnonymousReadAccess>
      </authorizationStrategy>
      <securityRealm class="hudson.security.HudsonPrivateSecurityRealm">
        <disableSignup>true</disableSignup>
        <enableCaptcha>false</enableCaptcha>
      </securityRealm>
      ...
    </hudson>

I think you are looking for this as i am able to revert it back to my default config.xml remember always make a backup of config before modifying it. just update those two tags authorizationStrategy & securityRealm and your are good to go. And for further reference check out jenkins_xml_reference

Problem

Yesterday, I locked myself out of jenkins while trying to configure ldap authentication, so I followed the instructions in the wiki and disabled security in the config.xml file via ssh. Now I want to get back to the normal jenkins security, but the possibility is not given under "Configure Jenkins" anymore. So I'm looking for a possibility to restore normal security through the config.xml. Here is the relevant part of the current config.xml file: ``` <hudson> <disabledAdministrativeMonitors/> <version>1.477</version> <numExecutors>3</numExecutors> <mode>NORMAL</mode> <useSecurity>true</useSecurity> <authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/> <securityRealm class="hudson.security.SecurityRealm$None"/> ... </hudson> ``` Has anyone an idea or maybe a valid part of a config.xml?

Original source