Jenkins — Reset Global Authentication (use own use database)

You may have authentication in Jenkins server for example, user name and password based on login mechanism.

What happens if you lost your admin credentials?

or lets take a scenario (which I faced), I enabled git-hub based login mechanism and lost our control our Jenkins authentication. No one could not login with admin credentials in Jenkins UI (browser) since it was routing to git-hub url for login and which resulted in 404 page.

How did I resolve this issue?

Firstly, I tried deleting the plugin (github-login) used for enabling the login in jenkins, it didnt work out for me. Then my ultimate aim was to disable to authentication mechanism and access the jenkins in web browser. Then delete the plugin and bring back the user based authentication mechanism.

The step that helped

Logged in to the jenkins server machine, navigated to var/jenkins_home and you will find config.xml. To be safe, I took a copy of that file, cp config.xml config_backup.xml.

If you look at the config.xml, you will find <useSecurity>true</useSecurity> if you have enabled authentication. I replaced this to false like shown here. Restart the jenkin server (mine is running in docker).

After restart, you wont have any login mechanism, jenkins is open. You can access manage jenkins section, go the installed plugin section, remove authentication plugin (in my case, I used github-login), create a new user if you want, enable the authentication back.

This will make your jenkin again use security, but this time, user name and password based login. And happy part it that you have credentials.

If you look the config.xml file now, you will see that <useSecurity>true</useSecurity>.

It was a time saving solution, I was able to bring back jenkins with security.

Burn More, Learn More!!

Front End Engineer | Netherlands. They say being human means having doubts yet still continuing on your path, so as I am.