You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何重置Jenkins用户ID和密码?以及如何彻底卸载清除备份后重新安装Jenkins以配置新设置?

Absolutely, you can fully wipe Jenkins from your system and start fresh—this is the surest way to get rid of the old login credentials and start over. Let’s break this down into two paths: first, a quick fix to reset your security settings (in case you just want to recover access without full reinstall), and second, the full clean uninstall if you want a totally fresh start.

Option 1: Reset Security Settings Without Reinstalling

If you’d rather not reinstall, you just need to find the config.xml file to disable security temporarily, then reset your credentials. Here’s where to look for it on different systems:

  • Windows: Check C:\Program Files\Jenkins\config.xml or C:\Users\<YourUsername>\.jenkins\config.xml (if Jenkins runs as your user)
  • Linux: Default path is /var/lib/jenkins/config.xml
  • macOS: Look in /Users/Shared/Jenkins/Home/config.xml or /Library/Application Support/Jenkins/config.xml

Once you find the file:

  1. Stop the Jenkins service first (via Services on Windows, sudo systemctl stop jenkins on Linux, brew services stop jenkins on macOS)
  2. Open config.xml in a text editor
  3. Find the line <useSecurity>true</useSecurity> and change it to <useSecurity>false</useSecurity>
  4. Save the file and restart Jenkins
  5. When Jenkins loads, you’ll be able to access the dashboard without login. Head to Manage Jenkins > Configure Global Security to re-enable security and set a new admin account.
Option 2: Full Clean Uninstall & Reinstall

If you want a totally fresh setup (and couldn’t find the config file), follow these steps to remove every trace of Jenkins from your system:

Windows

  • Stop the Jenkins service: Open services.msc (search for "Services" in the Start menu), find Jenkins, right-click and select Stop
  • Uninstall Jenkins: Go to Control Panel > Programs > Programs and Features, find Jenkins, and click Uninstall
  • Delete residual files:
    • Remove the installation directory (default: C:\Program Files\Jenkins)
    • Delete the Jenkins home folder: Check C:\Users\<YourUsername>\.jenkins or C:\Windows\System32\config\systemprofile\.jenkins (this is where Jenkins stores all your jobs, credentials, and settings)
    • Remove the service entry: Open Command Prompt as admin and run sc delete Jenkins
  • Optional: Clean the registry (advanced) - Open regedit and delete keys under HKEY_LOCAL_MACHINE\SOFTWARE\Jenkins

Linux (Debian/Ubuntu)

  • Stop the service: sudo systemctl stop jenkins
  • Purge Jenkins (removes the app and configuration files): sudo apt-get purge jenkins
  • Delete all residual data folders: sudo rm -rf /var/lib/jenkins /var/cache/jenkins /var/log/jenkins
  • Clean up unused dependencies: sudo apt-get autoremove --purge

Linux (RHEL/CentOS/Fedora)

  • Stop the service: sudo systemctl stop jenkins
  • Uninstall Jenkins: sudo yum remove jenkins
  • Delete residual data: sudo rm -rf /var/lib/jenkins /var/cache/jenkins /var/log/jenkins
  • Clean package cache: sudo yum clean all

macOS

  • Stop Jenkins:
    • If installed via Homebrew: brew services stop jenkins
    • If installed via the official pkg: sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
  • Uninstall:
    • Homebrew: brew uninstall jenkins
    • Pkg installer: sudo rm -rf /Applications/Jenkins
  • Delete core data folders: sudo rm -rf /Users/Shared/Jenkins/Home
  • Remove launch daemon: sudo rm /Library/LaunchDaemons/org.jenkins-ci.plist
  • Optional: Clean Homebrew residuals: brew cleanup jenkins

After completing these steps, reinstall Jenkins normally—you’ll get the initial setup wizard to create a new admin user and configure your instance from scratch.

内容的提问来源于stack exchange,提问作者AshishPuma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 17:57:52