# Elasticsearch-setup-passwords interactive batch

**URL:** <https://discuss.elastic.co/t/elasticsearch-setup-passwords-interactive-batch/213158>\
**Category:** Elasticsearch\
**Created:** [December 27, 2019, 8:39am UTC](https://discuss.elastic.co/t/elasticsearch-setup-passwords-interactive-batch/213158 "2019-12-27T08:39:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![screwyy](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@screwyy](https://discuss.elastic.co/u/screwyy)\
**Post date:** [December 27, 2019, 8:39am UTC](https://discuss.elastic.co/t/elasticsearch-setup-passwords-interactive-batch/213158/1 "2019-12-27T08:39:46Z")

</div>

hello,

I'm using elasticsearch 7.3.1 and I am automating my deployment of elasticsearch with ansible. This involves managing users and their passwords (elastic, kibana etc.)  
I'm using file realm and nothing else (no native realm nothing else) since it fits my needs and it's easy with ansible to manage files on all nodes. Everything is ok with  
bin/elasticsearch-users useradd user -p password -r role  
and  
bin/elasticsearch-users passwd user -p password  
but it's not working for `elastic` user ☹ so I turn to setup-passwords but I'm having issues with "elasticsearch-setup-passwords": The script allows an auto or interactive and `-b, --batch If enabled, run the change password process without prompting the user.`.

```
 [root@tsmlmfetruesl01 elasticsearch]# bin/elasticsearch-setup-passwords interactive -b
 Enter password for [elastic]: ^C
 [root@tsmlmfetruesl01 elasticsearch]# printf "elastic" | bin/elasticsearch-setup-passwords interactive -b
 Exception in thread "main" java.lang.IllegalStateException: unable to read from standard input; is standard input open and a tty attached?
    at org.elasticsearch.cli.Terminal$SystemTerminal.readText(Terminal.java:173)

```

1. How exactly should this batch mode be used if I only want to change/reset the elastic password ?

2. What is the purpose of having standard elastic setting or X-Pack in setup-password script `-E <KeyValuePair> Configure a setting`?

3. If I manually change the elastic password with  
elasticsearch-setup-password auto  
I can no longer change the elastic password like this:  
[How to set passwords for built-in users in batch mode?](https://discuss.elastic.co/t/how-to-set-passwords-for-built-in-users-in-batch-mode/119655/6)

Wait for elasticsearch instance on that node to be up and If I do a curl with the new password from keystore it does not work. But the curl works with the old password.  
So if for some reason someone changes the elastic password I am unable to reset it.

---

<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:** [January 24, 2020, 8:42am UTC](https://discuss.elastic.co/t/elasticsearch-setup-passwords-interactive-batch/213158/2 "2020-01-24T08:42:33Z")

</div>

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