# How to enable x-pack security when running elasticsearch locally from source code

**URL:** <https://discuss.elastic.co/t/how-to-enable-x-pack-security-when-running-elasticsearch-locally-from-source-code/228533>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [April 17, 2020, 2:09pm UTC](https://discuss.elastic.co/t/how-to-enable-x-pack-security-when-running-elasticsearch-locally-from-source-code/228533 "2020-04-17T14:09:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amitmbm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amitmbm/32/102111_2.png) [@amitmbm](https://discuss.elastic.co/u/amitmbm)\
**Post date:** [April 17, 2020, 2:09pm UTC](https://discuss.elastic.co/t/how-to-enable-x-pack-security-when-running-elasticsearch-locally-from-source-code/228533/1 "2020-04-17T14:09:28Z")

</div>

I am running the latest Elasticsearch code(taken from the master branch on 17th April 2020) and its running successfully and I was able to start it in debug mode in Intellij by following [Failing to run on Intellij in debug mode](https://discuss.elastic.co/t/failing-to-run-on-intellij-in-debug-mode/227805/4).

Now I want to debug some x-pack security-related issue and for that, I need to put a breakpoint in org.elasticsearch.xpack.security.authc.esnative.NativeUsersStore class and need to have a `.security` the index also needs to create some users.

I was able to configure security in my local Elasticsearch node by following the [https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-security.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-security.html) but that required putting below configs in `elasticsearch.yml`.

```
xpack.security.enabled : true
xpack.security.transport.ssl.enabled: true

```

Now, .security index is created and I was also able to create a new user with password, but when I deleted the user or get the user using the API, it's not hitting the breakpoint in methods like

org.elasticsearch.xpack.security.authc.esnative.NativeUsersStore#deleteUser  
org.elasticsearch.xpack.security.authc.esnative.NativeUsersStore#getUser

Please advise how can I use the debugger in this case?

Thanks in advance

---

<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:** [April 20, 2020, 8:31am UTC](https://discuss.elastic.co/t/how-to-enable-x-pack-security-when-running-elasticsearch-locally-from-source-code/228533/2 "2020-04-20T08:31:54Z")

</div>

Hi @amitmbm,

You can set settings by passing them as parameters to your `gradle` command, prefixed by `-Dtests.es.`

for instance, to enable security , pass `-Dtests.es.xpack.security.enabled=true`

---

<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 18, 2020, 8:31am UTC](https://discuss.elastic.co/t/how-to-enable-x-pack-security-when-running-elasticsearch-locally-from-source-code/228533/3 "2020-05-18T08:31:54Z")

</div>

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