When accessing the Jenkins console through PublicIp:port, you’ll be prompted to input your username and password. If you’ve forgotten either or both, the following steps will guide you through the process of resetting your credentials.
Initiate a connection to the Jenkins server by employing SSH tools such as MobaXterm or PuTTY.
Upon SSH access to the server, transition to the root user by executing the command ‘sudo su — ‘,
followed by navigating to the Jenkins home directory with the command ‘cd /var/lib/jenkins’.
sudo su -
cd /var/lib/jenkins
In the Jenkins home directory (/var/lib/jenkins), you will locate a file named config.xml.
ls
ls -l
Open and edit the config.xml file. I recommend using the Vim editor for this task.
vim config.xml
On the 7th line of the config.xml file, you’ll observe the attribute ‘use security’ set to ‘true’.
Modify it to ‘false,’ and save the changes to the file by using the command ‘:wq’ after pressing the ‘Esc’ key.
After making the changes, restart Jenkins and inspect its status with the following commands:
systemctl restart jenkins
systemctl status jenkins
Now, navigate to the Jenkins console, refresh the page, and you should be able to access the console without requiring a username and password.
To reset the password, follow these steps:
1. In the Jenkins Dashboard, click on ‘Manage Jenkins.’
2. Scroll down and click on ‘Security.’
Dashboard → Manage Jenkins → Security
3. Choose ‘Jenkins own user database’ from the ‘Authentication’ dropdown.
4. Click on ‘Save’ to apply the changes.
Now, return to the Jenkins Dashboard, click on ‘Manage Jenkins,’ and then select ‘Users.’
Note: The ‘Users’ option becomes available after choosing ‘Jenkins own user database’ in the previous step.
Here, you will find a list of all Jenkins users. If you have only the ‘admin’ user and wish to reset its password, click on the'settings' icon next to the admin user.
Scroll down, enter the desired password for the admin user, and click on ‘Save’ to apply the new password.
Congratulations! The password has been reset successfully.
Now, enter the username and the new password. Click on ‘Sign In’ to log in with the updated credentials.
Following these steps, you can successfully set a new password for the admin user in Jenkins.
It seems like you’re providing a guideline or best practice. If you have a specific instruction or recommendation you’d like to share, feel free to provide more details, and I can assist in formulating it or incorporating it into a set of best practices for Jenkins administration.
To enhance security and restrict access to the ‘Manage Jenkins’ tab, follow these steps:
Click on ‘Manage Jenkins.’
Navigate to ‘Security.’
Scroll down to the ‘Authorization’ section.
From the ‘Authorization’ dropdown, choose ‘Logged-in users can do anything.’
Click on ‘Save’ to apply the changes.
Great! By following the specified steps and adjusting the authorization settings, you’ve successfully restricted access to the ‘Manage Jenkins’ tab and job details without entering a username and password. This adds an additional layer of security to your Jenkins instance. If you have any more instructions or if there’s anything else you’d like assistance with, feel free to let me know!
Fantastic! I’m glad to hear that everything is set up successfully. If you have any more questions or if there’s anything else I can help you with in the future, feel free to reach out. Happy learning, and have a great time using Jenkins! 😊🚀