virtualMachinesonarqube

Modify the default administrator password

Change the default administrator password manually

You can manually change the administrator password from the command line by following these steps:

  • Log in to the server console.

  • Obtain your database credentials. Learn how to find database credentials.

  • Once you have obtained the database credentials and loaded the environment, you should be able to change the administrator password by connecting to the PostgreSQL server. To do so, execute the following commands:

    NOTE: Replace the NEW-PASSWORD placeholder with the new password you wish to use and enter your database password when prompted:

      $ user="admin"
      $ new_salt=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 40 ; echo '')
      $ new_password="NEW-PASSWORD"
      $ salted_password=$(echo -n "--${new_salt}--${new_password}--" | sha1sum | awk '{print $1}')
      $ psql --username=postgres bitnami_sonarqube -c "UPDATE users SET crypted_password='$salted_password', salt='$new_salt', hash_method='SHA1' WHERE login='$user';"
    

Now, you should be able to access your application using the new password.

NOTE: To change the password for a different user account, replace the admin username in the first command with the username of the account you wish to modify.

Change the default administrator password from the SonarQube dashboard

You can change the administrator password from the SonarQube dashboard by following these steps:

  • Log in to the SonarQube dashboard.

  • Under the “User Name” dropdown menu in the upper right corner, click on “My Account”.

    User account settings

  • Select the “Security” tab.

  • Enter your old password and enter your new password twice to confirm the change.

    Change the default administrator password

  • Click the “Change password” button.

Last modification December 21, 2022