To Reset Jenkins root password on Ubuntu 20.04/22.04 LTS, you can follow the steps and make your process simple to reset jenkins root password on ubuntu.

Introduction:

Jenkins is a popular automation server used for continuous integration and continuous delivery (CI/CD) pipelines. If you’ve forgotten or need to reset the root password for Jenkins on your Ubuntu 20.04/22.04 LTS server, this guide will walk you through the process.

Prerequisites:

Before you begin, make sure you have:

  1. Access to a terminal on your Ubuntu 20.04/22.04 LTS server.

Steps of “How to Reset Jenkins Root Password on Ubuntu 20.04/22.04 LTS?”

Let’s start the steps to Reset Jenkins Root Password on Ubuntu 20.04/22.04 LTS

  • Let’s try to login jenkins through the web portal ( ip address:8080 )

Here we have facing the issue of Invalid username or password. So, Let’s reset the jenkins root password

  • Stop Jenkins: To reset the Jenkins root password, first stop the Jenkins service. Open a terminal and run:
ubuntu@Rushi-InfoTech:~$ sudo systemctl stop jenkins
  • Edit Jenkins Configuration File: Now, open the Jenkins configuration file in a text editor. This file is typically located at /var/lib/jenkins/config.xml. You can use a text editor like nano or vim. For example:
ubuntu@Rushi-InfoTech:~$ sudo vi /var/lib/jenkins/config.xml
  • Locate the <useSecurity> Element: Inside the config.xml file, search for the <useSecurity> element. It should look like this:
<useSecurity>true</useSecurity>

Change true to false:

<useSecurity>false</useSecurity>

This temporarily disables security, allowing you to reset the password.

  • Save and Close the File: If you’re using vi editor, save the changes by pressing “Esc+ :wq”, then enter.
  • Restart Jenkins: Start the Jenkins service again:
ubuntu@Rushi-InfoTech:~$ sudo systemctl start jenkins
  • To verify the status of Jenkins.
ubuntu@Rushi-InfoTech:~$ sudo service jenkins status
  • Access Jenkins Without Authentication: With security temporarily disabled, open a web browser and visit http://your_server_ip_or_domain:8080 (replace your_server_ip_or_domain with your server’s actual IP or domain).

Now you can access the Jenkins dashboard but as a root user. So, to set password Click on Manage Jenkins.

  • Reset the Admin Password: In the Jenkins web interface, you can now access Jenkins without a password. Navigate to “Manage Jenkins” > “Configure Global Security.”
  • Enable Security: Change security realm as “Jenkins own user database ” and click on “Save”.
  • Then click on People on left side of dashboard. Now, select the username then the Configure option will be available on Left side of dashboard.
  • Click on Configure now.
  • Set a New Admin Password: Now scroll down to password option, you can set a new password for the admin user. Enter a strong password and confirm it.
  • Save and Apply Changes: Save the changes and apply them.
  • Restart Jenkins Again: Finally, restart the Jenkins service to apply the changes: sudo systemctl restart jenkins
  • Now if you reopen the web portal with ( Ip adress:8080 ) you will redirect to sign in page. Enter your Credentials with the password which you set before,
  • You have successfully login into Jenkins with your new password.

Conclusion:

In this guide, we’ve demonstrated how to reset the Jenkins root password on an Ubuntu 20.04/22.04 LTS server. Jenkins is a powerful automation server that plays a critical role in continuous integration and continuous delivery pipelines. However, it’s essential to maintain secure access to Jenkins to protect your automation workflows and data.By following these steps, you can maintain the security and accessibility of your Jenkins server, ensuring that your CI/CD pipelines continue to run smoothly while protecting your Jenkins instance from unauthorized access.

In this article we have learnt the steps to Reset Jenkins Root Password on Ubuntu 20.04/22.04 LTS, clearly and step-by-step. Follow the order to make the process smooth.

Related Articles:

Real Time Scenerios Ansible playbooks with labs

Reference:

Jenkins official page

Any queries pls contact us
https://rushiinfotech.in/contact/

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *