# Secure elasticsearch with password

**URL:** <https://discuss.elastic.co/t/secure-elasticsearch-with-password/253910>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [October 31, 2020, 8:44pm UTC](https://discuss.elastic.co/t/secure-elasticsearch-with-password/253910 "2020-10-31T20:44:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Labidi\_Ayoub](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/labidi_ayoub/32/45116_2.png) [@Labidi\_Ayoub](https://discuss.elastic.co/u/Labidi_Ayoub)\
**Post date:** [October 31, 2020, 8:44pm UTC](https://discuss.elastic.co/t/secure-elasticsearch-with-password/253910/1 "2020-10-31T20:44:19Z")

</div>

Hello elk community,

If it is possible, I want to know how to secure the elasticsearch as for example in Mysql the access with login and password, that is to say the access to the elasticsearch is done by password ??

Best Regards,  
Ayoub Labidi

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [October 31, 2020, 10:00pm UTC](https://discuss.elastic.co/t/secure-elasticsearch-with-password/253910/2 "2020-10-31T22:00:02Z")

</div>

More informations are [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-started-enable-security.html)

1. Add `xpack.security.enabled: true` into `elasticsearch.yml`

2. If you use a single node, then add `discovery.type: single-node`  
to `elasticsearch.yml`

3. Run your cluster

4. Add build in user :` /bin/elasticsearch-setup-passwords interactive`

---

<div class="post-metadata">

**Author:** ![Labidi\_Ayoub](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/labidi_ayoub/32/45116_2.png) [@Labidi\_Ayoub](https://discuss.elastic.co/u/Labidi_Ayoub)\
**Post date:** [October 31, 2020, 10:56pm UTC](https://discuss.elastic.co/t/secure-elasticsearch-with-password/253910/3 "2020-10-31T22:56:22Z")

</div>

thanks a lot @ylasri

---

<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:** [November 28, 2020, 10:56pm UTC](https://discuss.elastic.co/t/secure-elasticsearch-with-password/253910/4 "2020-11-28T22:56:23Z")

</div>

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