azureopenproject

Modify the default administrator password

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

Change the PostgreSQL password

You can modify the PostgreSQL password using the following command at the shell prompt:

$ psql -U postgres
postgres=# alter user postgres with password 'NEW_PASSWORD';
postgresl=# \q

Reset the PostgreSQL password

If you don’t remember your PostgreSQL database password, you can follow the steps below to reset it to a new value:

  • Change the authentication method in the PostgreSQL configuration file pg_hba.conf from md5 to trust and reload the configuration.

    • Approach A (Bitnami installations using system packages):

      $ sudo sed -ibak 's/^\([^#]*\)md5/\1trust/g' /opt/bitnami/postgresql/conf/pg_hba.conf
      $ sudo -u postgres pg_ctl reload
      
    • Approach B (Self-contained Bitnami installations):

      $ sudo sed -ibak 's/^\([^#]*\)md5/\1trust/g' /opt/bitnami/postgresql/data/pg_hba.conf
      $ sudo -u postgres pg_ctl reload
      
  • Connect to the PostgreSQL database and set the password to a new value:

    $ psql -U postgres
    postgres=# alter user postgres with password 'NEW_PASSWORD';
    postgresl=# \q
    
  • Finally, change the authentication method back to md5 and reload the old PostgreSQL configuration:

  • Approach A (Bitnami installations using system packages):

        $ sudo sed -i 's/^\([^#]*\)trust/\1md5/g' /opt/bitnami/postgresql/conf/pg_hba.conf
        $ sudo -u postgres pg_ctl reload
    
    • Approach B (Self-contained Bitnami installations):

      $ sudo sed -i 's/^\([^#]*\)trust/\1md5/g' /opt/bitnami/postgresql/data/pg_hba.conf
      $ sudo -u postgres pg_ctl reload
      

You should now be able to connect to PostgreSQL with the new password.

Last modification November 19, 2020