Please define an environment variable 'OPENSEARCH_INITIAL_ADMIN_PASSWORD' with a strong password string

Opensearch version 3.3.1 on Linux x64

I try to follow the documentation of tarball installation. My operating system is Ubuntu 24.04

On the docs site:

Step 1: Download and unpack OpenSearch (done)

Step 2: Configure important system settings (done)

Step 3: (Optional) Test OpenSearch

Option 1: Test your OpenSearch settings with security enabled

$ export OPENSEARCH_INITIAL_ADMIN_PASSWORD=2HXvSfYFJa#4Uxqe5Rf^K
$ echo $OPENSEARCH_INITIAL_ADMIN_PASSWORD
2HXvSfYFJa#4Uxqe5Rf^K
$ ./opensearch-tar-install.sh
OpenSearch 2.12.0 onwards, the OpenSearch Security Plugin introduces a change that requires an initial password for 'admin' user.
Please define an environment variable 'OPENSEARCH_INITIAL_ADMIN_PASSWORD' with a strong password string.
If a password is not provided, the setup will quit.
For more details, please visit: https://opensearch.org/docs/latest/install-and-configure/install-opensearch/tar/

Why failed? I think the password is very strong. Again, I try put enviroment OPENSEARCH_INITIAL_ADMIN_PASSWORD on:

  • /etc/environment: relogin (I am using remote ssh to this PC), test echo $OPENSEARCH_INITIAL_ADMIN_PASSWORD. Still failed.
  • $HOME/.profile and after relogin (I am using remote ssh to this PC), test echo $OPENSEARCH_INITIAL_ADMIN_PASSWORD, still failed again.

@gwijaya Could you try the following command?

env OPENSEARCH_INITIAL_ADMIN_PASSWORD=<strong_password> ./opensearch-tar-install.sh

Still got the same message:

$ env OPENSEARCH_INITIAL_ADMIN_PASSWORD=2HXvSfYFJa#4Uxqe5Rf^K ./opensearch-tar-install.sh
OpenSearch 2.12.0 onwards, the OpenSearch Security Plugin introduces a change that requires an initial password for 'admin' user.
Please define an environment variable 'OPENSEARCH_INITIAL_ADMIN_PASSWORD' with a strong password string.
If a password is not provided, the setup will quit.
For more details, please visit: https://opensearch.org/docs/latest/install-and-configure/install-opensearch/tar/

Ok I found the culprit… I think. I have JAVA_HOME environment manually set on my ~/.profile before on my Ubuntu, /usr/lib/jvm/java-17-openjdk-amd64/ eventhough java is openjdk version "21.0.8" 2025-07-15(system binary). After unset JAVA_HOME, I can execute opensearch-tar-install.sh

@gwijaya I’ve installed a fresh instance of Ubuntu 24.04 and followed the OpenSearch documentation and had no issues.
I’ve also used your password.

The top message is just informative and doesn’t stop the startup. OpenSearch will confirm that the password was set

Admin password set successfully.
pablo@ubuntutemplate:~/opensearch-3.3.2$ export OPENSEARCH_INITIAL_ADMIN_PASSWORD=2HXvSfYFJa#4Uxqe5Rf^K
pablo@ubuntutemplate:~/opensearch-3.3.2$ echo $OPENSEARCH_INITIAL_ADMIN_PASSWORD
2HXvSfYFJa#4Uxqe5Rf^K
pablo@ubuntutemplate:~/opensearch-3.3.2$ ./opensearch-tar-install.sh 
OpenSearch 2.12.0 onwards, the OpenSearch Security Plugin introduces a change that requires an initial password for 'admin' user. 
Please define an environment variable 'OPENSEARCH_INITIAL_ADMIN_PASSWORD' with a strong password string. 
If a password is not provided, the setup will quit. 
For more details, please visit: https://opensearch.org/docs/latest/install-and-configure/install-opensearch/tar/
### OpenSearch Security Demo Installer
### ** Warning: Do not use on production or public reachable systems **
OpenSearch install type: .tar.gz on Linux 6.8.0-48-generic amd64
OpenSearch config dir: /home/pablo/opensearch-3.3.2/config/
OpenSearch config file: /home/pablo/opensearch-3.3.2/config/opensearch.yml
OpenSearch bin dir: /home/pablo/opensearch-3.3.2/bin/
OpenSearch plugins dir: /home/pablo/opensearch-3.3.2/plugins/
OpenSearch lib dir: /home/pablo/opensearch-3.3.2/lib/
Detected OpenSearch Version: 3.3.2
Detected OpenSearch Security Version: 3.3.2.0
Admin password set successfully.
...
pablo@ubuntutemplate:~$ curl --insecure -u admin:2HXvSfYFJa#4Uxqe5Rf^K https://localhost:9200
{
  "name" : "ubuntutemplate",
  "cluster_name" : "opensearch",
  "cluster_uuid" : "OUg61q6BSF68lnQ7QePwcg",
  "version" : {
    "distribution" : "opensearch",
    "number" : "3.3.2",
    "build_type" : "tar",
    "build_hash" : "6564992150e26aaa62d4522a220dfff5188aeb88",
    "build_date" : "2025-10-29T22:24:07.450919802Z",
    "build_snapshot" : false,
    "lucene_version" : "10.3.1",
    "minimum_wire_compatibility_version" : "2.19.0",
    "minimum_index_compatibility_version" : "2.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}
pablo@ubuntutemplate:~$ curl --insecure -u admin:2HXvSfYFJa#4Uxqe5Rf^K https://localhost:9200/_plugins/_security/authinfo?pretty
{
  "user" : "User [name=admin, backend_roles=[admin], requestedTenant=null]",
  "user_name" : "admin",
  "user_requested_tenant" : null,
  "remote_address" : "[::1]:57258",
  "backend_roles" : [
    "admin"
  ],
  "custom_attribute_names" : [ ],
  "roles" : [
    "own_index",
    "all_access"
  ],
  "tenants" : {
    "global_tenant" : true,
    "admin_tenant" : true,
    "admin" : true
  },
  "principal" : null,
  "peer_certificates" : "0",
  "sso_logout_url" : null
}
pablo@ubuntutemplate:~$