how can we reset the username and password in windows for Jenkins. or is there a way to uninstall Jenkins completely so that when I reinstall it , I can again create a username and password?
Any solutions would be very much appreciated
how can we reset the username and password in windows for Jenkins. or is there a way to uninstall Jenkins completely so that when I reinstall it , I can again create a username and password?
Any solutions would be very much appreciated
You can simply delete the entire JENKINS_HOME directory and then restart the server. This will prompt you to the new setup wizard.
Open JENKINS_HOME/config.xml and disable security by setting the following.
<useSecurity>false</useSecurity>
Then access Jenkins and open the Script Console(JENKINS_URL/script). Execute the following script to create a new user.
import jenkins.model.*
import hudson.security.*
def j = Jenkins.getInstance()
def realm = new HudsonPrivateSecurityRealm(false)
realm.createAccount("newadmin","newpass")
j.setSecurityRealm(realm)
j.save()
Now enable security again and login to Jenkins with the new user.
Additional
If you want to recover the old user. After following the above steps open the file JENKINS_HOME/users/newadmin_RANDOM_NUMBER/config.xml and copy the following two values seed and passwordHash to the old admins config.xml(If the old admins username is admin the file should be located at JENKINS_HOME/users/admin_RANDOM_NUMBER/config.xml)
<jenkins.security.seed.UserSeedProperty>
<seed>405397d771ce33e7</seed>
</jenkins.security.seed.UserSeedProperty>
and
<hudson.security.HudsonPrivateSecurityRealm_-Details>
<passwordHash>#jbcrypt:$2a$10$UGYgHccQxAd9V6neqfJxx.......</passwordHash>
</hudson.security.HudsonPrivateSecurityRealm_-Details>
Then restart the server and you should be able to use the password of newadmin for admin.