# Cannot start elasticsearch with the root user

**URL:** https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607
**Category:** Elasticsearch
**Created:** [December 6, 2022, 3:54pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607 "2022-12-06T15:54:58Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![ericmalta](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ericmalta](https://discuss.elastic.co/u/ericmalta)
#### Post date: [December 6, 2022, 3:54pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/1 "2022-12-06T15:54:58Z")

</div>

Have you seen that when you start the cluster it says you cannot start with the root user but then you change the /usr/share/elasticsearch and elasticsearch data directory ownership to the elasticsearch user and still the same?

---

<div class="post-metadata">

### Author: ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)
#### Post date: [December 6, 2022, 4:25pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/2 "2022-12-06T16:25:11Z")

</div>

you need to provide some more detail about output you getting.

I am starting elasticsearch as root and it is working

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [December 6, 2022, 4:30pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/3 "2022-12-06T16:30:25Z")

</div>

You [should never ever run Elasticsearch as root](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/es-security-principles.html#security-not-root-user) and I believe this should be checked on startup if you are in production mode and fail if you are starting as root.

---

<div class="post-metadata">

### Author: ![ericmalta](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ericmalta](https://discuss.elastic.co/u/ericmalta)
#### Post date: [December 6, 2022, 4:31pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/4 "2022-12-06T16:31:33Z")

</div>

```auto
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) ~[elasticsearch-cli-7.10.2.jar:7.10.2]
	at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.10.2.jar:7.10.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.10.2.jar:7.10.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.10.2.jar:7.10.2]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111) ~[elasticsearch-7.10.2.jar:7.10.2]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178) ~[elasticsearch-7.10.2.jar:7.10.2]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) ~[elasticsearch-7.10.2.jar:7.10.2]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.10.2.jar:7.10.2]

```

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [December 6, 2022, 4:44pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/5 "2022-12-06T16:44:24Z")

</div>

> Caused by: java.lang.RuntimeException: can not run elasticsearch as root

This error message indicates that Elasticsearch is checking whether you are running as root and refusing to start as this is the case.

---

<div class="post-metadata">

### Author: ![ericmalta](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ericmalta](https://discuss.elastic.co/u/ericmalta)
#### Post date: [December 6, 2022, 4:48pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/6 "2022-12-06T16:48:52Z")

</div>

This is the only box I'm seeing this error. The others are running as root and this is not happening.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [December 6, 2022, 4:50pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/7 "2022-12-06T16:50:34Z")

</div>

Are the nodes in a cluster or running as standalone nodes? Can you show us the process listing from one of the other nodes together with the node configuration?

It looks like you are running a quite old version that is EOL. Do you have any thirdparty plugins installed that may affect this behaviour? Are there any configuration differences between the nodes?

---

<div class="post-metadata">

### Author: ![ericmalta](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ericmalta](https://discuss.elastic.co/u/ericmalta)
#### Post date: [December 6, 2022, 4:54pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/8 "2022-12-06T16:54:23Z")

</div>

@Christian_Dahlqvist thanks for your reply. This is a single-node cluster

---

<div class="post-metadata">

### Author: ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)
#### Post date: [December 6, 2022, 6:55pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/9 "2022-12-06T18:55:36Z")

</div>

let me correct my self.

I am starting up daemon as root.  
but process is running as user elasticsearch

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [December 7, 2022, 3:02am UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/10 "2022-12-07T03:02:44Z")

</div>

Elasticsearch will never run as root. It has inbuilt checks to only run as a non-root user and it will refuse to run otherwise, there's no way around this.

---

<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: [January 4, 2023, 3:03am UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-with-the-root-user/320607/11 "2023-01-04T03:03:38Z")

</div>

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