# How to secure the default elastic username and password in elasticsearch.yml, logstash.yml and kibana.yml files?

**URL:** <https://discuss.elastic.co/t/how-to-secure-the-default-elastic-username-and-password-in-elasticsearch-yml-logstash-yml-and-kibana-yml-files/269133>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [April 2, 2021, 7:32pm UTC](https://discuss.elastic.co/t/how-to-secure-the-default-elastic-username-and-password-in-elasticsearch-yml-logstash-yml-and-kibana-yml-files/269133 "2021-04-02T19:32:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patr123](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Patr123](https://discuss.elastic.co/u/Patr123)\
**Post date:** [April 2, 2021, 7:32pm UTC](https://discuss.elastic.co/t/how-to-secure-the-default-elastic-username-and-password-in-elasticsearch-yml-logstash-yml-and-kibana-yml-files/269133/1 "2021-04-02T19:32:40Z")

</div>

I want to secure the username and password which are in plaintext in my elasticsearch.yml, logstash.yml and kibana.yml files. How can I do it? My ELK stack version is 7.10.2.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 2, 2021, 8:37pm UTC](https://discuss.elastic.co/t/how-to-secure-the-default-elastic-username-and-password-in-elasticsearch-yml-logstash-yml-and-kibana-yml-files/269133/2 "2021-04-02T20:37:04Z")

</div>

Have a look at [Secure settings | Elasticsearch Guide [7.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/secure-settings.html)

---

<div class="post-metadata">

**Author:** ![Patr123](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Patr123](https://discuss.elastic.co/u/Patr123)\
**Post date:** [April 2, 2021, 11:48pm UTC](https://discuss.elastic.co/t/how-to-secure-the-default-elastic-username-and-password-in-elasticsearch-yml-logstash-yml-and-kibana-yml-files/269133/3 "2021-04-02T23:48:44Z")

</div>

Hello Dadoonet,

Thank you for the reply but the link doesn't mention how to add the add the default usernames and password in keystore clearly. Also once these two fields are added into the keystore, what changes are needed in the 3 yml files?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 3, 2021, 3:28am UTC](https://discuss.elastic.co/t/how-to-secure-the-default-elastic-username-and-password-in-elasticsearch-yml-logstash-yml-and-kibana-yml-files/269133/4 "2021-04-03T03:28:59Z")

</div>

> [@Patr123](#):
>
> what changes are needed in the 3 yml files?

I'd just remove them from `elasticsearch.yml` file.

For Kibana: [Secure settings | Kibana Guide [8.11] | Elastic](https://www.elastic.co/guide/en/kibana/current/secure-settings.html)

For Logstash: [Secrets keystore for secure settings | Logstash Reference [8.11] | Elastic](https://www.elastic.co/guide/en/logstash/current/keystore.html)

---

<div class="post-metadata">

**Author:** ![Patr123](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Patr123](https://discuss.elastic.co/u/Patr123)\
**Post date:** [April 5, 2021, 4:24pm UTC](https://discuss.elastic.co/t/how-to-secure-the-default-elastic-username-and-password-in-elasticsearch-yml-logstash-yml-and-kibana-yml-files/269133/5 "2021-04-05T16:24:29Z")

</div>

Thank you Dadoonet. This is working now. Like you mentioned, I removed those fields from elasticsearch.yml file and made the changes to the other 2 yml files as described in the link and restarted my services individually.

---

<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:** [May 3, 2021, 4:24pm UTC](https://discuss.elastic.co/t/how-to-secure-the-default-elastic-username-and-password-in-elasticsearch-yml-logstash-yml-and-kibana-yml-files/269133/6 "2021-05-03T16:24:34Z")

</div>

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