# Bootstrap.password for first installation with scripting

**URL:** <https://discuss.elastic.co/t/bootstrap-password-for-first-installation-with-scripting/342611>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [September 8, 2023, 1:34pm UTC](https://discuss.elastic.co/t/bootstrap-password-for-first-installation-with-scripting/342611 "2023-09-08T13:34:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pepite](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@pepite](https://discuss.elastic.co/u/pepite)\
**Post date:** [September 8, 2023, 1:34pm UTC](https://discuss.elastic.co/t/bootstrap-password-for-first-installation-with-scripting/342611/1 "2023-09-08T13:34:45Z")

</div>

Hi everybody,

I need test for a script to change passwords of the built-in users.  
I test on a single-node cluster.  
I understand that i have to

- stop service on the node

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

- start service

- change the password with api

```auto
curl -k -uelastic:tititi -XPUT -H 'Content-Type: application/json' 'https://IP:9200/_xpack/security/user/kibana/_password' -d '{ "password":"tototo" }'
curl -k -uelastic:tititi -XPUT -H 'Content-Type: application/json' 'https://IP:9200/_xpack/security/user/elastic/_password' -d '{ "password":"tototo" }'

```

But it doesnt work for me; it seems keeping my first test with  
`elasticsearch-setup-passwords interactive`  
I remove all the application many times but same error of authenticate

Is anybody knows how reset, reinitialize my first password ? please  
. that way i will can test my script of installation and modify the built-in users passwords

thanks a lot for the help 🙂

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 8, 2023, 2:54pm UTC](https://discuss.elastic.co/t/bootstrap-password-for-first-installation-with-scripting/342611/2 "2023-09-08T14:54:18Z")

</div>

the `bootstrap.*` is only used when you first create the cluster.  
Not after.

---

<div class="post-metadata">

**Author:** ![pepite](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@pepite](https://discuss.elastic.co/u/pepite)\
**Post date:** [September 11, 2023, 7:22am UTC](https://discuss.elastic.co/t/bootstrap-password-for-first-installation-with-scripting/342611/3 "2023-09-11T07:22:01Z")

</div>

Hello,

Thanks for the answer.  
Yes i know but for test my scripting i would like to know if it is possible to reset bootstrap.\* to test many times the cluster's creation without having to completely reinstall the server of testing  
And I don't find how to do this reinitalize

😉

Thanks a lot

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 11, 2023, 11:46am UTC](https://discuss.elastic.co/t/bootstrap-password-for-first-installation-with-scripting/342611/4 "2023-09-11T11:46:42Z")

</div>

If you remove the data dir (which means all data, settings...), that should work as a new cluster.

---

<div class="post-metadata">

**Author:** ![pepite](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@pepite](https://discuss.elastic.co/u/pepite)\
**Post date:** [September 11, 2023, 1:17pm UTC](https://discuss.elastic.co/t/bootstrap-password-for-first-installation-with-scripting/342611/5 "2023-09-11T13:17:52Z")

</div>

thanks i will try to remove

```auto
/etc/elasticsearch
/usr/share/elasticsearch
and my path.data : /var/lib/elasticsearch

```

Thanks a lot

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 11, 2023, 1:32pm UTC](https://discuss.elastic.co/t/bootstrap-password-for-first-installation-with-scripting/342611/6 "2023-09-11T13:32:19Z")

</div>

But if you are doing integration tests, I'd highly recommend using docker instead.  
That way, you can start a new container every time and you can easily provide the password you want to use by using `ELASTIC_PASSWORD`.

For example: [How to set elasticsearch user "elastic" password in Dockerfile - #2 by dadoonet](https://discuss.elastic.co/t/how-to-set-elasticsearch-user-elastic-password-in-dockerfile/226206/2)

---

<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 9, 2023, 1:32pm UTC](https://discuss.elastic.co/t/bootstrap-password-for-first-installation-with-scripting/342611/7 "2023-10-09T13:32:39Z")

</div>

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