# Password cannot be changed because it contains quotes

**URL:** https://discuss.elastic.co/t/password-cannot-be-changed-because-it-contains-quotes/304111
**Category:** Elasticsearch
**Tags:** elastic-stack-security
**Created:** [May 6, 2022, 10:29am UTC](https://discuss.elastic.co/t/password-cannot-be-changed-because-it-contains-quotes/304111 "2022-05-06T10:29:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![frankmehlhop](https://avatars.discourse-cdn.com/v4/letter/f/74df32/32.png) [@frankmehlhop](https://discuss.elastic.co/u/frankmehlhop)
#### Post date: [May 6, 2022, 10:29am UTC](https://discuss.elastic.co/t/password-cannot-be-changed-because-it-contains-quotes/304111/1 "2022-05-06T10:29:18Z")

</div>

When I generate elastic I got a password which includes quotes. ( like 'xxxxx"xxxx' )  
This is hard to use in code (C#) so I like to change the password.  
But there I get exception because the quotes too.  
**How can I change the password with quotes in it?**

doing:

```auto
POST /_security/user/elastic/_password
{
  "xxxxx\"xxxx" : "secret"
}

```

I get:

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "parse_exception",
        "reason" : "failed to parse change password request. unexpected field [xxxxx\"xxxx]"
      }
    ],
    "type" : "parse_exception",
    "reason" : "failed to parse change password request. unexpected field [xxxxx\"xxxx]"
  },
  "status" : 400
}

```

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [May 6, 2022, 11:01am UTC](https://discuss.elastic.co/t/password-cannot-be-changed-because-it-contains-quotes/304111/2 "2022-05-06T11:01:46Z")

</div>

> [@frankmehlhop](#):
>
> When I generate elastic I got a password which includes quotes

You mean the auto generated password that you get on first run ? This should not happen as we would not include these characters in the generated password. Are you certain that this is the password ?

In any case you can reset the password for the elastic user if you have access to the file system of the node by running `bin/elastisearch-reset-password` without passing the existing password as a parameter

---

<div class="post-metadata">

### Author: ![frankmehlhop](https://avatars.discourse-cdn.com/v4/letter/f/74df32/32.png) [@frankmehlhop](https://discuss.elastic.co/u/frankmehlhop)
#### Post date: [May 6, 2022, 11:23am UTC](https://discuss.elastic.co/t/password-cannot-be-changed-because-it-contains-quotes/304111/3 "2022-05-06T11:23:22Z")

</div>

Hi Ioannis,

I tried this also before.  
Looks like that:

```auto
>elasticsearch-reset-password -u elastic

ERROR: Failed to determine the health of the cluster.

```

And yes the auto generated password for the user elastic includes the quotes.

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [May 6, 2022, 12:47pm UTC](https://discuss.elastic.co/t/password-cannot-be-changed-because-it-contains-quotes/304111/4 "2022-05-06T12:47:25Z")

</div>

> [@frankmehlhop](#):
>
> And yes the auto generated password for the user elastic includes the quotes.

The code that generates the password is here : [https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/tool/CommandUtils.java#L23](https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/tool/CommandUtils.java#L23) and it is impossible for it to generate one that contain quotes as `"` is not part of the character set that is used for the password generation./

> [@frankmehlhop](#):
>
> ```auto
> ERROR: Failed to determine the health of the cluster.
> 
> ```

It looks like your cluster is not Green and your cannot interact with it until you fix that first. The `elasticsearch.log` file would contain pointers as to what is wrong with your cluster. Please take a look there.

---

<div class="post-metadata">

### Author: ![frankmehlhop](https://avatars.discourse-cdn.com/v4/letter/f/74df32/32.png) [@frankmehlhop](https://discuss.elastic.co/u/frankmehlhop)
#### Post date: [May 6, 2022, 12:59pm UTC](https://discuss.elastic.co/t/password-cannot-be-changed-because-it-contains-quotes/304111/5 "2022-05-06T12:59:26Z")

</div>

> [@ikakavas](#):
>
> elasticsearch.log

Thank you Ioannis! 🙂

---

<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: [June 3, 2022, 12:59pm UTC](https://discuss.elastic.co/t/password-cannot-be-changed-because-it-contains-quotes/304111/6 "2022-06-03T12:59:57Z")

</div>

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