Bootstrap.password for first installation with scripting

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

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 :slight_smile:

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


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

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

thanks i will try to remove

and my : /var/lib/elasticsearch

Thanks a lot

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

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