Jenkins: Accessed denied after turning on global security. How to revert?
edit the config.xml and replace the following two xml tags with the below version. Then restart your server.
<authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/> <securityRealm class="hudson.security.SecurityRealm$None"/>
Beware, your existing tags are probably spanning over several lines each.
You are getting this error because you enabled the security but don't have any user with permissions. To solve this problem, first edit
config.xml and set
I assume that you want to use local authentication (a local db of users) rather than an external db (i.e., LDAP). Follow the steps below taken from Jenkins Documentation.
- Go to the Configure Global Security screen (http://server/jenkins/configureSecurity/) and choose "enable security". An alternate URL to try is http://server:8080/configureSecurity.
- Select "Jenkins's own user database" as the security realm
- Place a check mark next to "Allow users to sign up"
- Select "Matrix-based security" as the authorization
- Give anonymous user the read access
- In the text box below the table, type in your user name (you'd be creating this later) and click "add"
- Give yourself a full access by checking the entire row for your user name
- Scroll all the way to the bottom, click "save"
Tested with version 1.566.
I suggest to revert the changes suggested in the accepted answer as it is likely to affect the steps above.
Two-liner fix (run on the server):
sudo ex +g/useSecurity/d +g/authorizationStrategy/d -scwq /var/lib/jenkins/config.xml sudo /etc/init.d/jenkins restart
sudo permission is required, or run as
Then login to Jenkins as usual and reconfigure the security again.