0
0
JenkinsHow-ToBeginner · 3 min read

How to Get Initial Admin Password in Jenkins Quickly

To get the initial admin password for Jenkins, locate the initialAdminPassword file inside the Jenkins home directory under /var/lib/jenkins/secrets/ on Linux or C:\Program Files\Jenkins\secrets\ on Windows. You can read this file using a command like sudo cat /var/lib/jenkins/secrets/initialAdminPassword to copy the password and use it to unlock Jenkins for the first time.
📐

Syntax

The initial admin password is stored in a file named initialAdminPassword located in the Jenkins home directory under the secrets folder.

Typical paths are:

  • Linux: /var/lib/jenkins/secrets/initialAdminPassword
  • Windows: C:\Program Files\Jenkins\secrets\initialAdminPassword

You can read the password by displaying the file content using commands like cat or type.

bash
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Output
e8f3a1b2c3d4e5f67890123456789abc
💻

Example

This example shows how to get the initial admin password on a Linux system where Jenkins is installed and running.

bash
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Output
e8f3a1b2c3d4e5f67890123456789abc
⚠️

Common Pitfalls

  • Wrong path: The Jenkins home directory may differ if customized, so check JENKINS_HOME environment variable.
  • Permission denied: You may need sudo or administrator rights to read the password file.
  • File missing: If Jenkins was already set up, the file might be deleted; in that case, reset the admin password instead.
bash
cat /var/lib/jenkins/secrets/initialAdminPassword
# May fail with permission denied

sudo cat /var/lib/jenkins/secrets/initialAdminPassword
# Correct way with elevated rights
Output
cat: /var/lib/jenkins/secrets/initialAdminPassword: Permission denied e8f3a1b2c3d4e5f67890123456789abc
📊

Quick Reference

Summary tips to get the Jenkins initial admin password:

  • Locate Jenkins home directory (/var/lib/jenkins by default on Linux).
  • Find the secrets/initialAdminPassword file.
  • Use sudo cat or equivalent to read the password.
  • Copy the password exactly to unlock Jenkins setup.

Key Takeaways

The initial admin password is stored in the secrets folder inside Jenkins home directory.
Use elevated permissions like sudo to read the password file if access is denied.
The default Jenkins home directory is /var/lib/jenkins on Linux and C:\Program Files\Jenkins on Windows.
If the password file is missing, Jenkins may already be set up or you need to reset the password.
Copy the password exactly from the file to unlock Jenkins for the first time.