Locked yourself out of Jenkins?

Removed all permissions from your account did you? Save it did you?  Feeling a bit stupid?

Yeah, me too!

First steps

SSH to your server and stop Jenkins

/etc/init.d/jenkins stop

Now modify the config XML

sudo vi /var/lib/jenkins/config.xml

You now have two options to regain access

Yeehaw way

Turn security off and remove the <authorizationStrategy> node


Now restart Jenkins and head over to your admin UI to resecure it quick before the trolls get in.

/etc/init.d/jenkins start

Like a boss way

If you want to be safe and not open up a security hole at all, you can add the security permissions into the config XML manually. Just replace USERNAME with own

<authorizationStrategy class=”hudson.security.ProjectMatrixAuthorizationStrategy”>



Now restart Jenkins and sit back with a smug grin.

/etc/init.d/jenkins start

Smug Croissant Guy

Smug Croissant Guy

29 Comments on “Locked yourself out of Jenkins?”

  1. Leif Madsen says:

    Very nice. I like being a boss!

  2. Thanks! Saved my day 🙂

  3. Harish says:

    Thanks for sharing! Saved my day too!

  4. carlgo11 says:

    Thanks! Really helped 🙂

  5. Bob says:

    This happened to a friend of mine and he was helped out by this post.

  6. Marko says:

    Hello, I stumbled upon your blog while searching google for problem about security TRUE and jenkins-cli safe-restart. Thing is described here http://serverfault.com/questions/570748/jenkins-cli-cannot-safe-restart-if-security-is-true

  7. […] would allow you to use the UI to set the security. In some cases this post can […]

  8. Praveen says:

    Thanks ,,it fixed all issues..!!

  9. Dave says:

    Appreciated. Thanks, man!

  10. STILL a boss in 2014 – for me this was because i’d somehow managed to get Jenkins to insert my name with a space in it rather than my actual username, don’t ask me how! I simply added these permissions to the existing ones and voila!

  11. bmcorser says:

    Charmant, monsieur

  12. abogdanov says:

    Thx a lot, you are the boss !!

  13. Pranesh Vittal says:

    Like a boss :). Thanks for the post.

  14. shehan says:


  15. Nice :). It was easier that I thought it would be!

  16. Venkat B says:

    Saved my day too 🙂 Thank you

  17. affsadfafsd says:

    like a bauss
    thanks man

  18. Ishwar says:

    Thank you so much!

  19. Chris says:

    This saved my afternoon, Thank you for posting this !

  20. cinlorac says:

    Thanks for this post! It really, really helped! Especially when I was on the verge of breaking down into tears on seeing the login screen 😥 😛

  21. George Tutoveanu says:

    Thanks, good job!

  22. Rajavel says:

    I’ve followed the steps to unlock in 2nd method, What about the password ?

  23. thwane says:

    Saved my day too!

  24. ram says:

    Thanks a lot. It worked.

  25. Larry Saldaña says:

    Thanks a lot !!!!!!! you are god !!

  26. […] to reset Jenkins security settings from the command line? Locked yourself out of Jenkins? […]

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 )

Facebook photo

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

Connecting to %s