47

I installed jenkins by downloading jenkins-2.2.pkg. After the installation is complete, Chrome auto-connected to http://localhost:8080/login?from=%2F and I see the following message:

Unlock Jenkins
To ensure Jenkins is securely set up by the administrator, a password has been written to the log (not sure where to find it?) and this file on the server:

/Users/Shared/Jenkins/Home/secrets/initialAdminPassword

Please copy the password from either location and paste it below.

But I don't have access to secrets folder on my Mac book even when I'm the Admin user.

Please help me on how to find the initial admin password?

Community
  • 1
  • 1
Srinivasan Ramu
  • 1,033
  • 4
  • 11
  • 23

17 Answers17

95
  1. Navigate to this folder /Users/Shared/Jenkins/Home
  2. Right click on secrets/ folder and select "Get Info"
  3. Scroll down to the right bottom corner of the pop up window and click on the lock image > enter your password > ok
  4. Click on the "+" at the left bottom corner of the pop up window and add the user 4.5 Click on Settings icon - left bottom and Apply changes.
  5. Open the "secrets" folder and find the initialAdminPassword file to get the initial admin password. If you don't have permission to the file, you need to right click on the file and select "Get Info" then repeat step 3 and 4 above to access the file.
Daniel Givoni
  • 665
  • 6
  • 12
user3397633
  • 966
  • 7
  • 2
35

Try it

sudo cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword

and copy the password.

Tuan Pham
  • 621
  • 9
  • 9
29

If you have installed Jenkins through HomeBrew, check

sudo cat /Users/$(whoami)/.jenkins/secrets/initialAdminPassword

Prashanth Sams
  • 19,677
  • 20
  • 102
  • 125
7

I install jenkins by img, use this command to cat password

sudo cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword
zcjlq
  • 71
  • 1
  • 2
4

If you have installed Jenkins using Docker and you are not able to find the password using the command :

$ sudo cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword

Then do following steps :

  1. Type in your command prompt : docker ps

  2. Find the running containerID

  3. Type docker exec -it <containerID> bash

  4. Type cd /var/jenkins_home/secrets

  5. Type cat initialAdminPassword

adityaatri
  • 1,967
  • 2
  • 7
  • 10
2

The current user might not have permissions to Secrets folder to access the initialAdminPassword file. So give permission by selecting "Secrets" folder by CMD+ i which launches a new screen and then unlock and then provide required permissions.

Locked file

Unlocked and Access to initialAdminPassword file

Gangadhar
  • 86
  • 9
2

Note if you are running Homestead / Vagrant and Ubuntu

sudo cat /var/lib/jenkins/secrets/initialAdminPassword
prola
  • 2,793
  • 1
  • 16
  • 15
2

If you homebrew installed JENKINS, then by default, JENKINS_HOME is at ~/.jenkins This is also the location where you will find you will find your initial password inside the secrets folder.

So: cd ~/.jenkins cd secrets open initialAdminPassword

2

If you are using jenkins image from dockerhub repo and create a container then you can get the initial password using:

$ sudo docker exec jenkins_containerid cat /var/lib/jenkins/secrets/initialAdminPassword

OR if installing from jenkins.io docs (https://jenkins.io/doc/book/installing/):

$ sudo docker exec jenkins_containerid cat /var/jenkins_home/secrets/initialAdminPassword

OR you can see the docker logs of container

$ sudo docker logs jenkinscontainerID
Community
  • 1
  • 1
dushyant
  • 349
  • 3
  • 7
1

ref:http://www.cimgf.com/2015/05/26/setting-up-jenkins-ci-on-a-mac-2/

  1. Make the Jenkins user an admin: sudo dseditgroup -o edit -a jenkins -t user admin

  2. Add the Jenkins user to the developer group: sudo dscl . append /Groups/_developer GroupMembership jenkins

  3. Make the Jenkins user automatically login when the computer is restarted:

Vinzz
  • 11
  • 1
1

For mac M1 on BigSur Os, the path I got is:

~/.jenkins/secrets 

https://www.jenkins.io/doc/book/installing/macos/

if not there look into /Users/Aakash~/.jenkins/secerts

Aakash Handa
  • 1,215
  • 11
  • 18
0

To unlock Jenkins, use this command in your terminal:

$ sudo cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword
AS Mackay
  • 2,831
  • 9
  • 19
  • 25
0

In my case, I was looking for this on MY MAC, but what you actually have to do is ssh to your docker container.

docker ps

which will display the containers, then copy the id of the container you created,

then do

docker exec -it <paste-id-here> /bin/bash

If that's successful, you will see your terminal change to, then you can run:

cat 
aprilmintacpineda
  • 1,114
  • 13
  • 21
0

As per Official Documentation they recommend Homebrew Installer. So if you did Homebrew Installer then check when the installation time it is printed in console or check in the current user jenkins folder.Cmd given below.

sudo cat /Users/$(whoami)/.jenkins/secrets/initialAdminPassword

0

Open your terminal and type:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword (or the path provided on the website opened).

I tried it from my Ec2 Amazon Instance and it worked!

0

None of these answers had enough information for me (installed via homebrew on mac). I did not have an initialAdminPassword file. Turns out it was because I ran the executable as a normal user. What I had to do was execute Jenkins from command line using sudo:

sudo jenkins

When I did that, I saw the following:

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

dee34d2b00804123456757ec46d3beef

This may also be found at: /var/root/.jenkins/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

Then I just pointed my browser to http://localhost:8080/ and filled out the form displayed there, at which time I could start installing plugins and actually using Jenkins.

enter image description here

Jeff Wright
  • 1,014
  • 1
  • 11
  • 17
-1

1.Double tap on finder select "Go to folder" enter /Users/Shared/Jenkins/Home

2.Check the "secret" folder , right click and select "get info"

3.Click on "lock" icon and enter admin password and make change in view type (change into user view) after this your folder is accessible .

4.Do same for password text file also