Sunday 29 May 2022

Reset Jenkins Admin Password


Make a backup copy of a Jenkins config file (If need to restore the previous settings)

cp -r /var/lib/jenkins/config.xml /var/lib/jenkins/config.xml.back


Disable the security

vim /var/lib/jenkins/config.xml 

<...>

<useSecurity>false</useSecurity>

<...>


Restart the Jenkins service

systemctl restart jenkins


Go to the Jenkins UI (No credentials this time) and reset the admin password


Navigate to "Manage Jenkins" 

In Security "Configure Global Security"

In Security Realm Select "Jenkins’ own user database" and  Save


Go to "People" From the Dashboard 

Select  username and "Configure"  Enter a new password in the "Password" and "Confirm password" fields and Save


Once the admin password is reset, restore the /var/lib/jenkins/config.xml file and restart Jenkins

 mv /var/lib/jenkins/config.xml.back /var/lib/jenkins/config.xml

 systemctl restart jenkins


No comments:

Post a Comment