top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-
Writer's pictureSuvi Raj

Recovering forgotten Jenkins credentials on macOS:

Jenkins is an open-source continuous integration/continuous delivery and deployment(CI/CD)automation software tool written in Java programming language. It is used to implement CI/CD workflows, called pipelines. However, it’s not uncommon for users to forget their Jenkins credentials, leading to access issues. Here, we will explore a step-by-step guide on how to recover forgotten Jenkins credentials on macOs.


Before we begin ensure that you have installed Jenkins on your macOS system and access to the terminal.

Open your terminal on your macOS(cmd+space and type terminal in the search bar)


If Jenkins is running as a service, stop it using the command 

brew services stop Jenkins


If you want to navigate to the Jenkins home directory using the terminal, you can use the ‘cd’, command. Assuming the Jenkins home directory is located in your user home directory and is named .jenkins, you can use the following command

cd .jenkins


This command changes the current working directory to the .jenkins directory within your home directory.

Open the Jenkins configuration file using the command 

vim config.xml

vim(text editor) allows you to create and edit text files on your Mac.

After the configuration file is opened, locate the section <useSecurity> then press I to enter insert mode, change <useSecurity>true<useSecurity> to <useSecurity>false</useSecurity>, and then save the changes by pressing ‘Esc’ to exit insert mode, followed by ‘:wq’ and press Enter.



Restart Jenkins using the command 

brew services start Jenkins


Now, navigate to ‘localhost:8080’ and press enter. You have encountered the following screen. However, note that the login functionality is not visible since we have disabled it by setting the ‘useSecurity’ tag to false earlier.




Proceed to the Jenkins homepage, and on the left side, locate and click on “Manage Jenkins”.Afterward, select “Security”.Within this section, we intend to modify the Security Realm to Jenkins’ own user database. Subsequently, navigate to the Authorization section and opt for Logged-in users can do anything. Once chosen, save the configuration changes.





Return to the Jenkins dashboard, proceed to the People section, and choose the user for whom you wish to modify the password. Click on “configure”, scroll down to the password section, set a new password, and save the changes.



Click the Sign-in button and log in using your updated password then successfully you will be logged in and your name will be displayed in the top right corner.


You have effectively reset your username and password for Jenkins by following the above steps.


Hope this blog will help you to recover your Jenkins credentials on macOS.

239 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page