Jenkins container Admin password: How I reset it
Technology changes every day, Server changes every day… approaches change every change now and then. And, It is quite possible that a server keep inactive for a long time and require to brush it up for some obvious reasons, verification or comparison with latest implementation. By the time password would have been out of the document.
How I reset the password of Jenkins container running on an AWS EC2 instance. Conceptually, I have to make my Jenkins web console password less. First activity is to allow the access only to my Laptop. I have edited the Security group for the same.
Then found out config.xml in the Jenkins home of the Jenkins container and made two copies, one as exact original copy and maintain till my experiment is over and another copy to do a text processing before I modify original confix.xml
sed -i 's/<useSecurity>true<\/useSecurity>/<useSecurity>false<\/useSecurity>/' config.xml
sed -i 's/<denyAnonymousReadAccess>true<\/denyAnonymousReadAccess>/<denyAnonymousReadAccess>false<\/denyAnonymousReadAccess>/' config.xml
sed -i 's/<disableSignup>true<\/disableSignup>/<disableSignup>false<\/disableSignup>/' config.xml
Then stopped and started the Jenkins container
# docket stop jenkins
# docker start jenkins
Then, accessed Jenkins console with the browser, IP:8080
Deleted Admin User and Changed security Settings like below
When saves the settings asked for creating new admin. Admin privileges can be set up based on the requirement. But for me it was not for a production environment and kept above setup.
Logged out of the web console and compared config.xml with original one. Verified it was working as required.
Disclaimer: It is recommended to do a thorough test before applying in production environment.