11

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

Andrew Gray
  • 3,593
  • 3
  • 35
  • 62
user3803807
  • 285
  • 4
  • 18
  • Possible duplicate of [How to "Unlock Jenkins"?](https://stackoverflow.com/questions/35960883/how-to-unlock-jenkins) – Yogesh_D Jun 15 '17 at 05:58

7 Answers7

7

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.

Andrew Gray
  • 3,593
  • 3
  • 35
  • 62
3

I found the long password in this path C:\Program Files\Jenkins\jinkins.err, in the jinkins.err file all the logs are recorded, so if you screw down slowly you can find the password being generated by the system.

Dharman
  • 30,962
  • 25
  • 85
  • 135
1

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.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

I was faced with the same issue in windows 10, following the below steps, it's working fine.

  1. Unlock Jenkins

unlock jenkins

  1. Open Command Prompt Run as Administrator

enter image description here

  1. Check and Go Junking Installed Location in Command Prompt

enter image description here

  1. Opens the jenkins.err.log file

enter image description here

  1. Find the password

enter image description here

Raja Rama Mohan Thavalam
  • 8,131
  • 2
  • 31
  • 30
0

Jenkins do this because it want to ensure Jenkins is securely set up by the administrator , So you cannot open this file direct you must going step by step to the path it given to you . C:\WINDOWS\system32\config\systemprofile.jenkins\secrets\initialAdminPassword

  1. Go to : C:\WINDOWS\ .
  2. Go to : system32
  3. .......
  4. .......

Continue tracking path

And you will found it .

Abd Abughazaleh
  • 4,615
  • 3
  • 44
  • 53
0

Open command prompt with admin privilege (i.e, "Run as Admin"). And then navigate to the folder as mentioned in the Jenkins localhost web page. And then run the following command: notepad initialadminpassword

this will display the password and then you can copy-paste it.

Kishan
  • 11
  • 2
0

if you use visual studio code

Go to container

Files -> var -> jenkins_home -> secrets -> initialadminpassword

Berhan Ay
  • 21
  • 3