Challenge - 5 Problems
Jenkins Admin User Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Jenkins CLI: Create Admin User Command Output
You run the Jenkins CLI command to create the first admin user with this script snippet:
What will be the output?
java -jar jenkins-cli.jar -s http://localhost:8080/ groovy = <<EOF
import jenkins.model.*
import hudson.security.*
def instance = Jenkins.getInstance()
println(instance.securityRealm.createAccount("admin", "admin123"))
EOFWhat will be the output?
Jenkins
java -jar jenkins-cli.jar -s http://localhost:8080/ groovy = <<EOF import jenkins.model.* import hudson.security.* def instance = Jenkins.getInstance() println(instance.securityRealm.createAccount("admin", "admin123")) EOF
Attempts:
2 left
💡 Hint
The createAccount method returns a UserDetails object, not a boolean or null.
✗ Incorrect
The createAccount method returns a UserDetails object representing the created user. It does not return true or null. SyntaxError is not possible here because the Groovy script is valid.
🧠 Conceptual
intermediate1:30remaining
Understanding Jenkins Security Realm for Admin User Creation
Which Jenkins security realm setting allows you to create the first admin user by default when Jenkins is freshly installed?
Attempts:
2 left
💡 Hint
The default Jenkins installation uses a built-in user database for authentication.
✗ Incorrect
By default, Jenkins uses its own user database (called Jenkins' own user database) to manage users including the first admin user. Other options require additional setup.
❓ Troubleshoot
advanced2:00remaining
Troubleshooting Jenkins Admin User Creation Failure
You tried to create the first admin user using a Groovy script in Jenkins CLI but got this error:
What is the most likely cause?
java.lang.NullPointerException: Cannot invoke method createAccount() on null object
What is the most likely cause?
Attempts:
2 left
💡 Hint
If security is disabled, securityRealm is null and cannot create users.
✗ Incorrect
If Jenkins security is disabled, the securityRealm object is null, so calling createAccount() on it causes a NullPointerException. Syntax errors or Jenkins not running would cause different errors.
🔀 Workflow
advanced2:30remaining
Steps to Create First Admin User in Jenkins via Script
What is the correct order of steps to create the first admin user in Jenkins using a Groovy script?
Attempts:
2 left
💡 Hint
You must first access CLI, then write and run script, then verify.
✗ Incorrect
The logical workflow is to access CLI, write the script, run it, then verify the user creation.
✅ Best Practice
expert3:00remaining
Best Practice for Securing First Admin User Creation in Jenkins
Which practice is best to secure the creation of the first admin user in Jenkins to avoid exposing credentials?
Attempts:
2 left
💡 Hint
Avoid putting passwords directly in code or sharing them openly.
✗ Incorrect
Using environment variables keeps passwords out of scripts and logs, improving security. Disabling security or sharing credentials openly is unsafe.