Provide credentials to Synchrony standalone using environment variables (Linux)

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

This guide applies to Confluence Data Center 6.5 and later.

This guide does NOT apply if Synchrony is managed by Confluence (available in Confluence 6.12 and later).

If you're running Synchrony standalone in a cluster, and you prefer to store sensitive information in your environment, rather than directly in the Synchrony startup scripts you can create a synchronyenv file, and use it to provide your database credentials.

These instructions are for Linux users. We'll assume your dedicated Synchrony user is named synchrony.

Solution

Steps

Create the synchronyenv file

  1. Change to your Synchrony user, for example:

    1 sudo su - synchrony
  2. In your <synchrony-home> directory, create a new file called synchronyenv.

  3. Add the following lines to the synchronyenv file, and include your database credentials.

    1 2 export SYNCHRONY_DATABASE_USERNAME="database-username" export SYNCHRONY_DATABASE_PASSWORD="database-password"
  4. Make sure to make this file executable, so it can be sourced by start-synchrony.sh

    1 chmod +x synchronyenv

Modify your Synchrony startup script

  1. Edit your start-synchrony.sh script.

  2. Comment out the following lines

    1 2 DATABASE_USER="<DB_USERNAME>" DATABASE_PASSWORD="<DB_PASSWORD>"

    Note that they may already be commented out, or have slightly different information.

  3. Uncomment the following line, and include the path to the synchronyenv file you've just created.

    1 SYNCHRONY_ENV_FILE="<PATH_TO_ENV_FILE>"
  4. Save your changes.

Modify your shell profile

Bash as login shell will load the following profiles in order. Your environment may vary, but this is an example for Ubuntu:

  • /etc/profile

  • ~/.bash_profile

  • ~/.bash_login

  • ~/.profile

Note: Bash as non-login interactive shell will load ~/.bashrc

  1. Edit the appropriate profile as noted above, and to add the following code:

    1 2 3 4 # Defines the absolute path to the synchronyenv file. # For example, if your synchronyenv file was located in /opt/synchrony-home/synchrony, you would use the example: source /opt/synchrony-home/synchrony/synchronyenv
  2. Confirm the variables are in place by exiting the bash session of the Synchrony user, then re-entering it, and running the following command:

    1 env
  3. Your database credentials defined should appear in your env output. Here's a sanitized example:

    1 2 3 4 5 6 XDG_SESSION_ID=15 SYNCHRONY_DATABASE_PASSWORD=<sanitized> ... SYNCHRONY_DATABASE_USERNAME=<sanitized> ... _=/usr/bin/env

If the info you defined in your synchronyenv file appears correctly in the output above, you should be good to start Synchrony once again. If they don't appear, you may need to define them in a different profile config, based on your operating system and shell.

Updated on April 16, 2025

Still need help?

The Atlassian Community is here for you.