# Set passwords with a script

**URL:** <https://discuss.elastic.co/t/set-passwords-with-a-script/211376>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [December 10, 2019, 8:59pm UTC](https://discuss.elastic.co/t/set-passwords-with-a-script/211376 "2019-12-10T20:59:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eoli3n](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eoli3n/32/59156_2.png) [@eoli3n](https://discuss.elastic.co/u/eoli3n)\
**Post date:** [December 10, 2019, 8:59pm UTC](https://discuss.elastic.co/t/set-passwords-with-a-script/211376/1 "2019-12-10T20:59:56Z")

</div>

Hi,

I want to set passwords using password API.  
I saw that method to set passwords : [https://discuss.elastic.co/t/how-to-set-passwords-for-built-in-users-in-batch-mode/119655/5](https://discuss.elastic.co/t/how-to-set-passwords-for-built-in-users-in-batch-mode/119655/5)

As i use docker elasticsearch, i setted bootstrap password with `ELASTIC_PASSWORD: changeme`.

When i try to set password manually it just do nothing, holding my term for an infinite time

```auto
$ curl -D- 'http://127.0.0.1:9200/_cluster/health?pretty' -u elastic:changeme
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 467

{
  "cluster_name" : "docker-cluster",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 1,
  "active_shards" : 2,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}
$ curl -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/_xpack/security/user/kibana/_password' -d '{ "password":"0LbH70f7j2z8FrBd166X" }' -u elastic:changeme

```

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![eoli3n](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eoli3n/32/59156_2.png) [@eoli3n](https://discuss.elastic.co/u/eoli3n)\
**Post date:** [December 11, 2019, 7:48am UTC](https://discuss.elastic.co/t/set-passwords-with-a-script/211376/2 "2019-12-11T07:48:43Z")

</div>

Ok that was weird... problem is "localhost" which is not resolved in curl query but is in nslookup query...  
Changed to 127.0.0.1 solved 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 8, 2020, 7:48am UTC](https://discuss.elastic.co/t/set-passwords-with-a-script/211376/3 "2020-01-08T07:48:44Z")

</div>

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