# How to find out if password of elastic user is already set or not

**URL:** <https://discuss.elastic.co/t/how-to-find-out-if-password-of-elastic-user-is-already-set-or-not/254872>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [November 10, 2020, 8:49am UTC](https://discuss.elastic.co/t/how-to-find-out-if-password-of-elastic-user-is-already-set-or-not/254872 "2020-11-10T08:49:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MartinG](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MartinG](https://discuss.elastic.co/u/MartinG)\
**Post date:** [November 10, 2020, 8:49am UTC](https://discuss.elastic.co/t/how-to-find-out-if-password-of-elastic-user-is-already-set-or-not/254872/1 "2020-11-10T08:49:18Z")

</div>

Hi there,

I am building up Elasticsearch clusters automatically with Ansible and have a problem with the initial setting of the "elastic" user password.

As described in the documentation a initial and transient bootstrap password is used to set the password of built-in user "elastic":

> When you install Elasticsearch, if the `elastic` user does not already have a password, it uses a default bootstrap password. The bootstrap password is a transient password that enables you to run the tools that set all the built-in user passwords.

I execute the following steps to set the password:

`printf "secret"|/usr/share/elasticsearch/bin/elasticsearch-keystore add -x "bootstrap.password"`

`Restart of the Elasticsearch node to make the bootstrap password active.`

`curl -k -u elastic:secret -XPUT https://localhost:9200/_security/user/elastic/_password -d '{ "password":"elastic" }' -H 'Content-Type: application/json'`

My problem is, that this procedure should run only on one node to prevent errors, when one node tries to set the password while another node set it already.

It would help if I could check if the password is already set or not.

Can someone help?

Best regards,

Martin

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [November 20, 2020, 7:08am UTC](https://discuss.elastic.co/t/how-to-find-out-if-password-of-elastic-user-is-already-set-or-not/254872/2 "2020-11-20T07:08:48Z")

</div>

Hi Martin,

There is no specific tooling we provide that solves your actual problem, I'm afraid. I think the best way to determine that is that since you know the `bootstrap.password` value, attempt to curl to `https://localhost:9200/` with `-uelastic:secret`. If you get a `200` it means that the elastic password is not yet set by any other node, if you get a `401` it means that the elastic password is already set.

HTH

---

<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:** [December 18, 2020, 7:08am UTC](https://discuss.elastic.co/t/how-to-find-out-if-password-of-elastic-user-is-already-set-or-not/254872/3 "2020-12-18T07:08:50Z")

</div>

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