Thursday, November 23, 2017

How to unlock jenkins on windows 10

Leave a Comment

I installed jenkins on my window 10 machine by using the msi I downloaded. It installed fine and has now launched the browser prompting me to unlock jenkins with the initialadminpassword. I can't find this file anywhere. I looked in the install directory C:\Program Files (x86)\Jenkins and I have checked the log files and no password was written to it. I even did a search on my whole C: for initialadminpassword and nothing came up. I do have a file called secret.key in my Jenkins install directory but the key in this file isn't working. Any ideas on how I can get around this would be very helpful

Thanks

2 Answers

Answers 1

In the Jenkins Home directory there should be a secrets subfolder. In that directory there should be a file called initialAdminPassword (no extension).

This file contains the password it is referring to.

Answers 2

In addition to "How to “Unlock Jenkins”?", I use a groovy script in order to make sure an admin account was created.

That means:

  • I copy the groovy script in <Jenkins>/ref/init.groovy.d/security.groovy
  • I launch jenkins.war with -Djenkins.install.runSetupWizard=false

In that script, replace the path of the files with the username/password by a Windows path one:

def user = new File("/run/secrets/jenkins-adm-name").text.trim() def pass = new File("/run/secrets/jenkins-adm-pass").text.trim() 

That way:

  • no wizard
  • one admin account with a username/password of my choosing.
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment