How to reset Jenkins security settings from the command line?

ryanzec picture ryanzec · Aug 8, 2011 · Viewed 340.3k times · Source

Is there a way to reset all (or just disable the security settings) from the command line without a user/password as I have managed to completely lock myself out of Jenkins?

Answer

Nowaker picture Nowaker · Dec 5, 2013

The simplest solution is to completely disable security - change true to false in /var/lib/jenkins/config.xml file.

<useSecurity>true</useSecurity>

Then just restart Jenkins, by

sudo service jenkins restart

And then go to admin panel and set everything once again.

If you in case are running your Jenkins inside k8s pod from a docker, which is my case and can not run service command, then you can just restart Jenkins by deleting the pod:

kubectl delete pod <jenkins-pod-name>

Once the command was issued, the k8s will terminate the old pod and start a new one.