# Can't change default password

**URL:** https://discuss.elastic.co/t/cant-change-default-password/88265
**Category:** Elasticsearch
**Created:** [June 5, 2017, 12:11pm UTC](https://discuss.elastic.co/t/cant-change-default-password/88265 "2017-06-05T12:11:56Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Shlomi\_Toren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shlomi_toren/32/18791_2.png) [@Shlomi\_Toren](https://discuss.elastic.co/u/Shlomi_Toren)
#### Post date: [June 5, 2017, 12:11pm UTC](https://discuss.elastic.co/t/cant-change-default-password/88265/1 "2017-06-05T12:11:56Z")

</div>

Hey, I installed Xpack for elasticsearch, and tried to to change the password as it says here:  
[https://www.elastic.co/guide/en/x-pack/current/security-getting-started.html](https://www.elastic.co/guide/en/x-pack/current/security-getting-started.html)

Running this:  
curl -XPUT -u elastic localhost:9200/\_xpack/security/user/elastic/\_password -H Content-Type: application/json -d {"password" : "elasticpassword"}

is getting me:  
{"error":{"root\_cause":[{"type":"json\_parse\_exception","reason":"Unexpected character ('p' (code 112)): was expecting double-quote to start field name\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@4a142671; line: 1, column: 3]"}],"type":"json\_parse\_exception","reason":"Unexpected character ('p' (code 112)): was expecting double-quote to start field name\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@4a142671; line: 1, column: 3]"},"status":500}curl: (6) Could not resolve host: application  
curl: (3) Bad URL, colon is first character  
curl: (3) [globbing] unmatched close brace/bracket in column 16

or, running this:

curl -XPUT -u elastic "localhost:9200/\_xpack/security/user/elastic/\_password" -H "Content-Type: application/json -d {"password" : "elasticpassword"}

gets me this:  
{"error":{"root\_cause":[{"type":"not\_x\_content\_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}],"type":"not\_x\_content\_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"},"status":500}

I can't seem to get it, no matter what combination of " or ' Im using. Please help!

Thanks

---

<div class="post-metadata">

### Author: ![skearns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skearns/32/125945_2.png) [@skearns](https://discuss.elastic.co/u/skearns)
#### Post date: [June 5, 2017, 12:51pm UTC](https://discuss.elastic.co/t/cant-change-default-password/88265/2 "2017-06-05T12:51:18Z")

</div>

It looks like you're missing some quotes in the first example, and have both unclosed and missing quotes in the second one. Here's what it should look like:

```auto
curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/elastic/_password' -H "Content-Type: application/json" -d '{"password" : "elasticpassword"}'

```

Note the single quotes around the URL, double quotes around the content-type, and the single quotes around the text following the -d. I believe the docs you link to have this quoted correctly, but let us know if there is an issue in the docs!

Thanks,  
Steve

---

<div class="post-metadata">

### Author: ![Shlomi\_Toren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shlomi_toren/32/18791_2.png) [@Shlomi\_Toren](https://discuss.elastic.co/u/Shlomi_Toren)
#### Post date: [June 5, 2017, 1:22pm UTC](https://discuss.elastic.co/t/cant-change-default-password/88265/3 "2017-06-05T13:22:16Z")

</div>

Hey Steve, thank you for replying.  
I tried that first, of course, but got this:

Enter host password for user 'elastic':  
curl: (6) Could not resolve host: 'localhost  
curl: (3) Bad URL, colon is first character  
curl: (3) [globbing] unmatched close brace/bracket in column 16

I assumed it was because of the single quotes.  
To remove any shadow of a doubt, I'm using curl through CMD.

BTW: using 127.0.0.1 or my actual IP doesn't change the outcome.

---

<div class="post-metadata">

### Author: ![Shlomi\_Toren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shlomi_toren/32/18791_2.png) [@Shlomi\_Toren](https://discuss.elastic.co/u/Shlomi_Toren)
#### Post date: [June 5, 2017, 1:36pm UTC](https://discuss.elastic.co/t/cant-change-default-password/88265/4 "2017-06-05T13:36:44Z")

</div>

This worked:  
curl -XPUT -u elastic localhost:9200/\_xpack/security/user/elastic/\_password -H "Content-Type: application/json" -d "{"password" : "elasticpassword"}"

Why do I need to escape quotes? I don't remember doing it previously.

---

<div class="post-metadata">

### Author: ![skearns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skearns/32/125945_2.png) [@skearns](https://discuss.elastic.co/u/skearns)
#### Post date: [June 5, 2017, 2:35pm UTC](https://discuss.elastic.co/t/cant-change-default-password/88265/5 "2017-06-05T14:35:16Z")

</div>

Hi Shiomi,

Glad to hear you were able to get it to work. On my mac, the command I pasted worked just fine. Perhaps on another OS, you may be required to include `http://` before localhost. but either way, glad you're up and running!

Thanks,  
Steve

---

<div class="post-metadata">

### Author: ![Shlomi\_Toren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shlomi_toren/32/18791_2.png) [@Shlomi\_Toren](https://discuss.elastic.co/u/Shlomi_Toren)
#### Post date: [June 6, 2017, 5:18am UTC](https://discuss.elastic.co/t/cant-change-default-password/88265/6 "2017-06-06T05:18:30Z")

</div>

Didn't help with the escape thing. Thanks anyway!

---

<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 4, 2017, 5:18am UTC](https://discuss.elastic.co/t/cant-change-default-password/88265/7 "2017-07-04T05:18:44Z")

</div>

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