How to reset Jenkins security settings from the command line?

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

<useSecurity>true</useSecurity>

A one-liner to achieve the same:

sed -i 's/<useSecurity>true<\/useSecurity>/<useSecurity>false<\/useSecurity>/g' /var/lib/jenkins/config.xml

Then just restart Jenkins:

sudo service jenkins restart

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

If you in case are running your Jenkins inside a Kubernetes pod 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, Kubernetes will terminate the old pod and start a new one.

Leave a Comment