Забыл пароль от jenkins linux

Как в Jenkins сбросить пароль

В Jenkins сбросить пароль можно двумя способами. Сброс пароля нужен если авторизация через веб-интерфейс невозможна. Пароль можно изменить или задать новый предварительно выключив авторизацию.

Как в Jenkins сбросить пароль администратора

Пароль администратора иногда оказывается утерян или забыт.

Если такое произошло — можно задать новый пароль.

Первый способ

Заключается во временном отключении авторизации.

В конфигурационном файле можно поменять значение параметра, который отвечает за то будет ли запрашиваться пароль вообще

Если значение установлено в False — пароль не запрашивается.

Далее службу нужно перезапустить

systemctl restart jenkins.service

Когда эти действия проделаны — можно зайти в веб-интерфейс без пароля и установить новый пароль, с которым удобно будет работать.

Затем поменять значение на True и перезапустить Jenkins.

Минус данного подхода в том, что какое-то время Jenkins оказывается полностью открыт и зайти без пароля может кто угодно.

Второй способ

Заключается в генерации хэша и задании его в качестве пароля в конфигурационном файле

Значение генерируется так

Затем оно добавляется в /var/lib/jenkins/admin/config.xml между открывающим и закрывающим тэгами passwordHash

Изменения вступят в силу после перезапуска

systemctl restart jenkins.service

Потом нужно убедиться в том, что сервис запустился и работает

systemctl status jenkins.service

Таким образом пароля менять безопаснее, но прибегая к нему добиться результата удается не всегда.

Читайте статью про установку Jenkins и начало работы.

Источник

How to Reset Jenkins Admin users Password

In this tutorial, you will learn how to reset the admin user’s password in Jenkins.

Have you ever created a Jenkins instance for your local development needs and then forget the username you set? Don’t fret, we’ve all done this before. Thankfully, the password can be reset by doing a number of tasks from the command-line.

You will need elevated privileges to perform a Jenkins admin password reset. We will be modifying the security context of the Jenkins instance, and essentially turning authentication off temporarily.

Читайте также:  Просмотр паролей пользователей linux

Once we have disabled password authentication, we will log into the Jenkins web console and set a new password for our user.

Disable Jenkins Security

Log onto your Jenkins server using an account with root privileges. Once logged in, look open Jenkin’s configration XML file into a text editor.

In the example below, we are opening the file in VIM.

sudo vi /var/lib/jenkins/config.xml

With the configuration file opened, perform a search for the useSecurity string. This can be done in VIM by pressing ESC and then entering /useSecurity .

The line you are looking for should resemble the following.

Press i to enter VIM’s insert mode. Modify the value between the tags and set the value to false .

Save your changes and then exit the text editor. If you are using VIM, press ESC and then enter wq! to write your changes and then exit the editor.

Your changes will not take affect until Jenkins is restarted. Restart the service now.

sudo systemctl restart jenkins

Reset Jenkins Admin’s Password

After Jenkins restarts navigate to the web console. Notice that you were not prompted for a username or password. This is because we disabled security in Jenkins’ configuration file.

If this is a publicly shared Jenkins instance, you should disable public access to the server until the password reset is complete.

To reset admin’s password, do the following.

  1. Click on People on the left-hand navigation menu.
  2. Click on the Admin.
  3. Delete the user account.
  4. Navigate to Jenkins / Manage Jenkins.
  5. Click on Configure Global Security
  6. Check the Enable Security check box
  7. Under Security Realm, select Jenkins’ own user database
  8. In the Authorization section, select Logged-in users can do anything.
  9. Unselect Allow anonymous read access.
  10. Click Save to save your changes.

Create New Jenkins Admin User

Once you have completed the tasks above, you will be redirect to a page where a new Admin user can be created. Fill in your new details and then click Create First Admin User.

You have no created a new Admin user with a new password.

Conclusion

Reseting the admin’s password is not a simple process. It also exposes us to dangers by disabling user logins, allowing anonymous users full control over the Jenkins server.

Читайте также:  Альт линукс установить время

This tutorial showed you how to reset the admin password by removing the current account, and then recreating it. A better solution would be to have multiple admins, where possible, and have another admin reset the password.

Источник

How to Reset Jenkins Admin User Password

Jenkins is a popular open-source automation server that is widely used for continuous integration and continuous delivery (CI/CD) in software development. As a system administrator, you may need to reset the Jenkins admin password if you have lost or forgotten it.

In this tutorial, we will learn how to reset the Jenkins admin password in a few simple steps.

Steps to Reset Jenkins Admin Password

Follow the below steps to recover admin account access to the Jenkins portal.

    Disable Current Security – First of all, login to your Jenkins server and edit the Jenkins configuration file (/var/lib/jenkins/config.xml) in your favorite text editor:

sudo vim /var/lib/jenkins/config.xml 

jenkins usersecurity to false

Disable the security by changing the `useSecurity` tag value to “false”. Save your file and close it. The vim users press the `ESC` button then type `:wq!` and hit Enter to save the file.
Apply Changes – Restart Jenkins service to apply the changes.

sudo systemctl restart jenkins 

After restarting make sure the Jenkins service is running with `sudo systemctl status jenkins` command.

  • Access Jenkins as Anonymous User – Again access Jenkins in a web browser, It will redirect you to the dashboard without prompting for authentication. You will be logged in as an anonymous user to Jenkins.
  • Under the Dashboard, go to the `People` option as seen in below image: How to Reset Jenkins Admin Password
  • Delete Admin Account – Select the Admin user account to delete. Then click the «Delete» button to detele the selected account: How to Reset Jenkins Admin PasswordClick «Yes» to confirm the account deletion. Jenkins Reset Admin User Password
  • Enable Security Again – Now once you deleted old admin user. To reset all security options, go to the “Jenkins” ->“Manage Jenkins” option in left-hand side option lists. Now click on the “Configure Global Security” option How to Reset Jenkins Admin User PasswordYou will see all option as bellow, do all below mentioned changes on this page
    • Enable the “Enable Security” option.
    • In Security Realm option select “Jenkins own database”
    • Make sure to uncheck the “Allow users to sign up” option under the “Jenkins own database” option. Jenkin Reset Admin Password

    Reset Jenkins Admin Account Password

  • Save Changes – Save all changes made above.
  • Create Admin Account – You will be redirected to “Create First Admin User”. Input all required details to create a new Admin account. Create a New Admin User in Jenkins
  • Login as New Admin User – Now, you can access your Jenkins dashboard using the newly created Admin account. Login Jenkins Admin Dashboard
  • All Done
  • Conclusion

    In this tutorial, we learned how to reset the Jenkins admin password in a few simple steps. We hope that this tutorial has helped you understand how to reset the Jenkins admin password and that you are now able to access your Jenkins instance. If you have any questions or need further assistance, please don’t hesitate to ask.

    Источник

    Jenkins: Reset Admin Password

    If you have forgotten the Jenkins admin password and can’t log in to a Jenkins user interface (UI) as administrator, you can connect to a Jenkins server via SSH and reset the Jenkins admin password.

    The simplest solution is to completely disable security in /var/lib/jenkins/config.xml file, access the Jenkins UI omitting authentication and rest the Jenkins admin password.

    Cool Tip: Jenkins Username & Password by Default! Read more →

    Reset Jenkins Admin Password

    Make a backup copy of a Jenkins config file (this step is important as after resetting the Jenkins admin password we would need to restore the previous settings):

    $ cp /var/lib/jenkins/config.xml /var/lib/jenkins/config.xml.back

    Open the config file /var/lib/jenkins/config.xml and disable the security:

    Restart the Jenkins service:

    $ systemctl restart jenkins

    Go to the Jenkins UI (you won’t be asked for any credentials this time) and reset the admin password:

    1. Navigate to «Manage Jenkins» -> «Security» -> «Configure Global Security» -> «Authentication»
    2. Select the «Security Realm» (e.g. «Jenkins’ own user database» ) and click on «Save»
    3. Go to «People» -> Click on a username for which you want to change the password (e.g. admin ) -> «Configure» -> Enter a new password in the «Password» and «Confirm password» fields and click on «Save»

    Once the admin password is reset, restore the previous /var/lib/jenkins/config.xml file and restart Jenkins:

    $ mv /var/lib/jenkins/config.xml.back /var/lib/jenkins/config.xml $ systemctl restart jenkins

    Источник

    Оцените статью
    Adblock
    detector