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


28 Comments on “Locked yourself out of Jenkins?”

  1. Leif Madsen says:

    Very nice. I like being a boss!

  2. Harish says:

    Thanks for sharing! Saved my day too!

  3. carlgo11 says:

    Thanks! Really helped 🙂

  4. Bob says:

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

  5. 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

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

  7. Praveen says:

    Thanks ,,it fixed all issues..!!

  8. Dave says:

    Appreciated. Thanks, man!

  9. 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!

  10. bmcorser says:

    Charmant, monsieur

  11. abogdanov says:

    Thx a lot, you are the boss !!

  12. Pranesh Vittal says:

    Like a boss :). Thanks for the post.

  13. shehan says:


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

  15. Venkat B says:

    Saved my day too 🙂 Thank you

  16. affsadfafsd says:

    like a bauss
    thanks man

  17. Ishwar says:

    Thank you so much!

  18. Chris says:

    This saved my afternoon, Thank you for posting this !

  19. 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 😥 😛

  20. George Tutoveanu says:

    Thanks, good job!

  21. Rajavel says:

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

  22. thwane says:

    Saved my day too!

  23. ram says:

    Thanks a lot. It worked.

  24. Larry Saldaña says:

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

  25. […] 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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s