# Reset Elasticsearch Internal User Password

**URL:** <https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [September 7, 2022, 2:10am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837 "2022-09-07T02:10:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hjsroldan](https://avatars.discourse-cdn.com/v4/letter/h/ea5d25/32.png) [@hjsroldan](https://discuss.elastic.co/u/hjsroldan)\
**Post date:** [September 7, 2022, 2:10am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837/1 "2022-09-07T02:10:05Z")

</div>

Hi,

Does anyone know how to reset or change Elasticsearch internal user password?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 7, 2022, 2:21am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837/2 "2022-09-07T02:21:12Z")

</div>

Have you tried [elasticsearch-reset-password | Elasticsearch Guide [8.4] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.4/reset-password.html)?

---

<div class="post-metadata">

**Author:** ![hjsroldan](https://avatars.discourse-cdn.com/v4/letter/h/ea5d25/32.png) [@hjsroldan](https://discuss.elastic.co/u/hjsroldan)\
**Post date:** [September 7, 2022, 2:36am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837/3 "2022-09-07T02:36:55Z")

</div>

Hi @warkolm,

I don't have the elasticsearch-reset-password in my bin directory. I'm using Elasticsearch 7.17.1.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/d/5dd8c76271f10d79999bae3a5edfaaf9ae072df7.png)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 7, 2022, 2:42am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837/4 "2022-09-07T02:42:47Z")

</div>

Please don't post pictures of text, logs or code. They are difficult to read, impossible to search and replicate (if it's code), and some people may not be even able to see them 🙂

What about [elasticsearch-users | Elasticsearch Guide [7.14] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.14/users-command.html)

---

<div class="post-metadata">

**Author:** ![hjsroldan](https://avatars.discourse-cdn.com/v4/letter/h/ea5d25/32.png) [@hjsroldan](https://discuss.elastic.co/u/hjsroldan)\
**Post date:** [September 7, 2022, 3:11am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837/5 "2022-09-07T03:11:44Z")

</div>

This is noted 🙂

Tried to reset the password of elastic and encountered this error.

[rhel@esnode1 elasticsearch-7.17.1]$ ./bin/elasticsearch-users passwd elastic

ERROR: Invalid username [elastic]... Username [elastic] is reserved and may not be used.

---

<div class="post-metadata">

**Author:** ![Yang\_Wang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yang_wang/32/48857_2.png) [@Yang\_Wang](https://discuss.elastic.co/u/Yang_Wang)\
**Post date:** [September 7, 2022, 4:02am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837/6 "2022-09-07T04:02:13Z")

</div>

What you need is to define a superuser with `elasticsearch-users` CLI. Then use that newly created user to call [ChangePassword API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html) to change password for the `elastic` user.

As @warkolm mentioned, you could use `elasticsearch-reset-password` if you are on version 8.x, which basically automates the above process for you (it also deletes the newly created user after the password change is completed).

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [September 7, 2022, 4:34am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837/7 "2022-09-07T04:34:59Z")

</div>

[Here](https://techexpert.tips/elasticsearch/elasticsearch-password-recovery/) is a quick tutorial / example of what @Yang_Wang suggested

---

<div class="post-metadata">

**Author:** ![hjsroldan](https://avatars.discourse-cdn.com/v4/letter/h/ea5d25/32.png) [@hjsroldan](https://discuss.elastic.co/u/hjsroldan)\
**Post date:** [September 7, 2022, 8:28am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837/8 "2022-09-07T08:28:38Z")

</div>

Hi @Yang_Wang and @stephenb,

Tried creating a new user with superuser privilege and changed the elastic user password using the newly created account like the example given by @stephen. I encountered this error while authenticating elastic account with the new password.

{  
"error" : {  
"root\_cause" : [  
{  
"type" : "security\_exception",  
"reason" : "unable to authenticate user [elastic] for REST request [/?pretty]",  
"header" : {  
"WWW-Authenticate" : [  
"Basic realm="security" charset="UTF-8"",  
"Bearer realm="security"",  
"ApiKey"  
]  
}  
}  
],  
"type" : "security\_exception",  
"reason" : "unable to authenticate user [elastic] for REST request [/?pretty]",  
"header" : {  
"WWW-Authenticate" : [  
"Basic realm="security" charset="UTF-8"",  
"Bearer realm="security"",  
"ApiKey"  
]  
}  
},  
"status" : 401  
}

---

<div class="post-metadata">

**Author:** ![Yang\_Wang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yang_wang/32/48857_2.png) [@Yang\_Wang](https://discuss.elastic.co/u/Yang_Wang)\
**Post date:** [September 8, 2022, 1:31am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837/9 "2022-09-08T01:31:49Z")

</div>

> [@hjsroldan](#):
>
> Tried creating a new user with superuser privilege and changed the elastic user password using the newly created account

What response did you get when you change the password? Was it successful?

How did you authenticate with the `elastic` user, is it via command line using cURL? If so please make sure any special characaters may need to be quoted. Of cousre, please make sure you inded entered the correct password and talked to the right Elasticsearch cluster.

If everything above is fine, I suggest you enable trace log for Elasticsearch and share the ES logs during the authentication failure for further troubleshooting. You can enable trace log with:

```auto
PUT _cluster/settings
{
  "transient": {
    "logger.org.elasticsearch.xpack.security.authc": "trace"
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 6, 2022, 1:31am UTC](https://discuss.elastic.co/t/reset-elasticsearch-internal-user-password/313837/10 "2022-10-06T01:31:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
