如何从命令行重置Jenkins安全设置? [英] How to reset Jenkins security settings from the command line?
问题描述
有没有办法在没有用户/密码的情况下从命令行重设所有(或只是禁用安全性设置),因为我设法完全将自己锁定在Jenkins
之外?
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
?
推荐答案
最简单的解决方案是完全禁用安全性-将/var/lib/jenkins/config.xml
文件中的true
更改为false
.
The simplest solution is to completely disable security - change true
to false
in /var/lib/jenkins/config.xml
file.
<useSecurity>true</useSecurity>
然后只需重新启动Jenkins,
Then just restart Jenkins, by
sudo service jenkins restart
然后转到管理面板并再次设置所有内容.
And then go to admin panel and set everything once again.
如果您是从docker在k8s pod中运行Jenkins,这是我的情况,并且无法运行service
命令,那么您可以通过删除pod来重新启动Jenkins:
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>
发出命令后,k8将终止旧的pod并开始一个新的pod.
Once the command was issued, the k8s will terminate the old pod and start a new one.
这篇关于如何从命令行重置Jenkins安全设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!