Operations 4 min read

How to Reset a Forgotten Elasticsearch 8.x/9.x Password Safely

When the built‑in elastic user password is lost in Elasticsearch 8.x or 9.x, you can use the official elasticsearch‑reset‑password command‑line tool to generate or set a new password without restarting the service, following a few simple steps and troubleshooting tips.

Mingyi World Elasticsearch
Mingyi World Elasticsearch
Mingyi World Elasticsearch
How to Reset a Forgotten Elasticsearch 8.x/9.x Password Safely

Problem

In Elasticsearch 8.x or 9.x, forgetting the password of a built‑in user such as elastic prevents login to the management console, showing “Username or password is incorrect. Please try again.”

Solution

Elasticsearch provides the elasticsearch-reset-password command‑line tool, which can reset built‑in user passwords without restarting the cluster.

Procedure

1. Open a shell in the Elasticsearch bin directory

cd /your/elasticsearch/path/bin

2. Run the reset command

Method 1 – Auto‑generate a strong password

./elasticsearch-reset-password -u elastic

The tool prints a newly generated password to the terminal.

Method 2 – Manually specify a new password (recommended)

./elasticsearch-reset-password -i -u elastic

The tool prompts for the new password and its confirmation.

Method 3 – Specify HTTPS URL

./elasticsearch-reset-password -i -u elastic --url https://localhost:9200

Adjust the URL, port, and hostname to match the HTTPS endpoint.

3. Follow the prompts

Enter and confirm the new password.

Command line reports “Password for the [elastic] user successfully reset.”

Common Issues

Command not found : Execute the command from the Elasticsearch bin directory.

Cluster health abnormal : Add the -f flag to force execution after resolving health problems.

HTTPS certificate errors : Use the --url option with a correct HTTPS address or verify certificate configuration.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

OperationsElasticsearchSecuritypassword resetelasticsearch-reset-password
Mingyi World Elasticsearch
Written by

Mingyi World Elasticsearch

The leading WeChat public account for Elasticsearch fundamentals, advanced topics, and hands‑on practice. Join us to dive deep into the ELK Stack (Elasticsearch, Logstash, Kibana, Beats).

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.