简体   繁体   中英

Default credentials for Jenkins after installation

I have downloaded Jenkins on Windows10. When i try to access jenkins, it is asking for username and password. I have read the threads on the same issue. But I do not find any secrets folder or config.xml file under Jenkins folder.

Username is admin . Password should be located in:

$JENKINS_HOME/secrets/initialAdminPassword

You can view the password using:

cat /var/lib/jenkins/secrets/initialAdminPassword

or

cat $JENKINS_HOME/secrets/initialAdminPassword

If you're using Jenkins inside of a Docker container, like I am, the following commands might be useful.

docker exec -it ${jenkins_container_name} \
    cat /var/jenkins_home/secrets/initialAdminPassword 
# or if it was the last container you ran
docker exec -it $(docker container ls -l --format "{{.Names}}") \
    cat /var/jenkins_home/secrets/initialAdminPassword

After Installation of Jenkins 2.YZ , I would suggest you to simply restart your OS.

my OS is Windows 8.1 , and as after I restarted Jenkins automatically builds it installation environment, and you can see many directories and files available or appeared which were not available instantly after installation.

Now, Open Jenkins Dashboard path in web browser hostname:portnumber

for beginners it is like localhost:8080

it will ask you the password.

So, open the file initialAdminPassword in text editor or viewer located in:

C:\Program Files (x86)\Jenkins\secrets\

copy the 32 chars length password , and paste it to the Jenkins Dashboard.

Later you can install the plugins default or in custom choose mode.

Hope this would help many one.

I found the file in this location on windows server 2019

C:\\Windows\\SysWOW64\\config\\systemprofile\\AppData\\Local\\Jenkins.jenkins\\secrets

I had this exact issue as well. After installing Jenkins, the installation directory just had some config files and the jre and bin folders. After rebooting Windows 10 I was able to see all the normal folders you would expect in a Jenkins installation:

  • jobs
  • jre
  • logs
  • nodes
  • plugins
  • secrets - The "secrets" folder only appeared after rebooting, and in it was initialAdminPassword just as promised.

Now going to http://localhost:8080 loads the "Unlock Jenkins" page.


Really, though. I should have known to reboot. It is Windows after all...

1) open terminal

2) type docker ps -a

then you will find the list of containers

3) copy your container id where your Jenkins is running

4) type docker logs your_container_id

then you will see

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

741bc43e03b54cd9be183d97947c7369

This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

同样的问题在重新启动后得到解决,我能够看到文件夹并且 jenkin 也开始响应。

open the door

sudo chmod -R 777 secrets

peek inside

vi secrets/initialAdminPassword

close the door

sudo chmod -R 700 secrets

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM