# Unable to authenticate user after password creation

**URL:** <https://discuss.elastic.co/t/unable-to-authenticate-user-after-password-creation/306359>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [June 3, 2022, 7:52pm UTC](https://discuss.elastic.co/t/unable-to-authenticate-user-after-password-creation/306359 "2022-06-03T19:52:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dorinand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dorinand/32/70521_2.png) [@dorinand](https://discuss.elastic.co/u/dorinand)\
**Post date:** [June 3, 2022, 7:52pm UTC](https://discuss.elastic.co/t/unable-to-authenticate-user-after-password-creation/306359/1 "2022-06-03T19:52:38Z")

</div>

I have created Elasticsearch built-in users password with:

```auto
bin/elasticsearch-setup-passwords interactive

```

I set for every user password `asdfasdf`. All successfuly:

```auto
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y

Enter password for [elastic]: 
Reenter password for [elastic]: 
Enter password for [apm_system]: 
Reenter password for [apm_system]: 
Enter password for [kibana_system]: 
Reenter password for [kibana_system]: 
Enter password for [logstash_system]: 
Reenter password for [logstash_system]: 
Enter password for [beats_system]: 
Reenter password for [beats_system]: 
Enter password for [remote_monitoring_user]: 
Reenter password for [remote_monitoring_user]: 
asdfasdfChanged password for user [apm_system]
Changed password for user [kibana_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]

```

Now, I should be able to get response from Elasticsearch but it does not work:

```auto
curl -u elstic:asdfasdf localhost:9200
{"error":{"root_cause":[{"type":"security_exception","reason":"unable to authenticate user [elstic] for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"unable to authenticate user [elstic] for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}

```

I running it in docker and mount port to localhost. I used default configuration of ES, this is my compose file:

```auto
version: '3.7'

services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
    ports:
      - 9300:9300
      - 9200:9200
    environment:
      - discovery.type=single-node
      - "xpack.security.enabled=true"
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

```

Maybe I am missing something but cant see what, in my opinion, it should work.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [June 4, 2022, 3:56am UTC](https://discuss.elastic.co/t/unable-to-authenticate-user-after-password-creation/306359/2 "2022-06-04T03:56:22Z")

</div>

typo in your `curl`?

`curl -u elstic:asdfasdf localhost:9200`

should be  
`curl -u elastic:asdfasdf localhost:9200`  
`..........^`

---

<div class="post-metadata">

**Author:** ![dorinand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dorinand/32/70521_2.png) [@dorinand](https://discuss.elastic.co/u/dorinand)\
**Post date:** [June 4, 2022, 8:39am UTC](https://discuss.elastic.co/t/unable-to-authenticate-user-after-password-creation/306359/3 "2022-06-04T08:39:48Z")

</div>

Thank you, I was sure there must be some typo but I could not found it. Thanx

---

<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:** [July 2, 2022, 8:40am UTC](https://discuss.elastic.co/t/unable-to-authenticate-user-after-password-creation/306359/4 "2022-07-02T08:40:38Z")

</div>

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