Change the default PostgreSQL database credentials

When you install WHD in a stand-alone deployment with the embedded PostgreSQL database, the application creates a new database with a default user name and password. This information is stored in the Database Connection screen at Setup > General > Database.

After the installation is completed, a message displays in the administrator console stating that the embedded database is not secure. To prevent unauthorized database access, create a new database login role and change the database ownership to a new role. When you are finished, apply the new log in credentials to the Database Connection screen and then restart WHD. When you log back in, your default database credentials are protected from unauthorized users by the new login role.

This section describes how to change the credentials for a Windows and Linux deployment.

Change the database credentials for a Windows deployment

Perform the following procedures to change the database credentials for a WHD deployment running Windows Server.

Open the Database Connection screen

  1. Log in to WHD as an administrator.

  2. Click Setup > General > Database.

    The Database Connection screen displays.

  3. Click Backup Now to back up your PostgreSQL database.

    A message displays, stating that your database was backed up to:

    <WebHelpDesk>/pgsq9/Backups

  4. Leave this screen open. Do not close this screen or log out of WHD.

Create a new login role

  1. Select a strong login role name and password to apply to your PostgreSQL database.

    Your new credentials will replace the default WHD user name and password you created during the installation procedure.

  2. Log in to the WHD server as an administrator.
  3. Open File Explorer and navigate to:

    C:\Program Files\WebHelpDesk\pgsql9\bin

  4. Locate and run pgAdmin3 as Administrator.

    pgAdmin3 is a management tool for PostgreSQL, and is included with your WHD installation. This tool is a database interface and is not the database program.
  5. In the pgAdmin III toolbar , click to open the New Server Registration window.
  6. Complete the fields in the Properties tab.

    1. In the Name field, enter a name for this connection.

      For example:

      WHD38

    2. In the Host field, enter localhost, as the PostgreSQL database is stored on the WHD server.
    3. In the Port field, enter 20293.

      This is the default port for communications with the PostgreSQL database.

    4. Leave the Service field blank.
    5. Click the Maintenance DB drop-down menu and select postgres.
    6. In the Username and password fields, enter whd.

      These are the original database credentials created during the installation procedure. You will replace these credentials in a later step.

    7. Accept the remaining defaults, and click OK.

      The new connection displays in the Object browser column under Server Groups > Servers.

      If the connection does not display, double-click Server Groups.
  7. In the Object browser column, maximize your new connection (for example, WHD38) and then maximize Login Roles.

    The whd role displays under Login Roles. This is the database login role created during the installation procedure.

  8. Create a new login role.
    1. Right-click Login Roles and select New Login Role to display the New Login Role dialog box.

    2. In the Properties tab, enter a name in the Role name field.

      For example:

      shawn

    3. Click the Definition tab.
    4. Enter a strong password in the Password fields.

      Record your new login role name and password and keep them in a safe place. You will need this information to update the Database Connection screen in WHD and make any role modifications in the future.
    5. Select a date and time in the future when this role expires.

      Note the expiration date in your personal calendar so you can update it in the future.
    6. Click the Role Privileges tab.
    7. Select all privileges.

    8. Click OK.

      The new role displays under Login Roles in the Object browser.

  9. Verify that your new login role has the same privileges as the whd database role.
    1. Under Login Roles, right click whd and select Properties.

    2. In the Login Role whd window, click the Role privileges tab.
    3. Confirm that the Role privileges for the whd role match those with your new role.

    4. Click Cancel.

Change the WHD database ownership

  1. In the Object browser under Databases, right-click whd and select Properties.

  2. In the Database whd window, click the Owner drop-down menu and select your new role.

  3. Click OK.
  4. Close pgAdmin3.

Update the database connection settings

  1. Switch back to the WHD Database Connection screen you opened at the beginning of this procedure.
  2. In the Username field, enter the login name you created for your new login role.

  3. In the Password field, enter the password you created for your new login role.

  4. (Optional) Select your backup options.
    1. In the Backup Schedule field, select the days of the week and the time of day when WHD will automatically back up your database.

      All backups are written by default to the pgsq/9/Backups directory under the Web Help Desk home directory. You can

    2. In the Backup Folder field, select a backup folder or accept the default section.

      By default, all backups are written to the pgsq/9/Backups directory under the Web Help Desk home directory. If desired, you can enter a path to a custom folder.

      All backups are created based on the backup schedule and named based on the backup time. For example, a scheduled backup performed on March 17, 2021 at 2:30 AM would be named as follows:

      B_2021_03_17-02_30_00

      It is your responsibility to copy the database backup files to a network or tape drive. Perform all backups before applying any update to Web Help Desk.
    3. Click the drop-down menu and select the number of backups.

  5. Click Save.

    A message displays, stating that the connection settings were saved and will take effect when you restart the application.

  6. Restart WHD.

Verify the new database connection

  1. Restart WHD.
  2. Log in to WHD as an administrator.
  3. Click Setup > General > Database.
  4. In the Database Connection screen, verify that the Username field contains the new login role.

Revert back to your original settings

After you restart WHD and you encounter an issue that prevents you from logging in to the web console, you can revert back to your original settings.

  1. Stop WHD.

  2. Open File Explorer and navigate to:

    C:\Program Files\WebHelpDesk\pgsql9\bin

  3. Locate and run pgAdmin3 as Administrator.
  4. In the Object browser, maximize Servers > <your_new_connection> > Databases.
  5. Right-click whd and select Properties.

  6. In the Database whd window, click the Owner drop-down menu and select whd.

  7. Click OK.
  8. Open File Explorer.
  9. Navigate to:

    C:\Program Files\WebHelpDesk\conf\

  10. Locate and delete the whd.properties file.

    This will delete the login name and database information you created in an earlier step. Your existing database remains intact.

  11. Start WHD.
  12. When prompted, select Use Embedded PostgreSQL database (recommended) and click Next.

    WHD starts.

  13. Log in to WHD using your administrator credentials.

  14. Click Setup > General > Database.

    The Database Connection screen displays with your original username and password.

Change the database credentials for a Linux deployment

Perform the following procedures to change the database credentials for a WHD deployment running CentOS, Fedora, or Red Hat Enterprise Linux.

Open the database connection screen

  1. Log in to WHD as an administrator.

  2. Click Setup > General > Database.

    The Database Connection screen displays.

  3. Click Backup Now to back up your PostgreSQL database.

    A message displays, stating that your database was backed up to:

    <WebHelpDesk>/pgsq9/Backups

  4. Leave this screen open. Do not close this screen or log out of WHD.

Create a new login role

  1. Select a strong login role name and password to apply to your PostgreSQL database.

    Your new credentials will replace the default WHD user name and password you created during the installation procedure.

  2. Open a command prompt.
  3. Log in to the Linux server as an administrator.

  4. Change directories to the PostgreSQL database bin directory.

    At the prompt, execute:

    cd /usr/local/webhelpdesk/pgsql9/bin
  5. At the prompt, execute the following command to create a new user—for example, Joe Smith.

    ./createuser -P -p 20293 -s -e joesmith -U postgres
  6. At the prompt, enter a new password for this role.

    Record the password for a later step.
  7. At the prompt, re-enter your password.

    WHD creates the new database role, password, and associated permissions for the new user.

  8. At the prompt, execute:

    ./psql -p 20293 -U joesmith -d whd

    WHD displays the current PostgreSQL database version and information about accessing help. A new prompt displays, indicating that you are logged in to the database.

    whd=#

Change the WHD database ownership

  1. Change the database ownership to the new user. For example, Joe Smith.

    At the prompt, execute:

    REASSIGN OWNED BY whd TO joesmith;

    Web Help Desk reassigns the PostgreSQL database ownership to the new user and returns to the database prompt.

    whd=#
  2. Exit the PostgreSQL database.

    At the prompt, execute:

    \q
  3. Leave the command prompt window open and update the database connection settings.

Update the database connection settings

  1. Navigate to the Database Connection screen that you opened in a previous step.
  2. Enter the user name of the new database owner.

  3. Enter the password you created for the new database owner.

  4. Click Save.

    WHD saves the connection settings, which take effect when you restart the application.

Verify the new database connection

  1. Return to the command prompt window.
  2. At the prompt, execute:

    ./dropuser -p 20293 -h localhost -e -U postgres  whd

    WHD drops the previous role and then displays the command prompt.

  3. Return to the Web Help Desk directory.

    Execute:

    cd /usr/local/webhelpdesk/
  4. Stop WHD.

    At the prompt, execute:

    ./whd stop

    WHD stops.

  5. Restart WHD.

    At the prompt, execute:

    ./whd start

    Web Help Desk restarts and displays the connection status and the command prompt.

  6. Log in to WHD as an administrator.

  7. Click Setup > General > Database.
  8. Verify that the Username field displays the new database owner. For example, Joe Smith.

    The default PostgreSQL database credentials are updated.