# What's wrong with my permissions?

**URL:** <https://discuss.elastic.co/t/whats-wrong-with-my-permissions/154880>\
**Category:** Elasticsearch\
**Created:** [October 31, 2018, 4:08pm UTC](https://discuss.elastic.co/t/whats-wrong-with-my-permissions/154880 "2018-10-31T16:08:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![monk](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@monk](https://discuss.elastic.co/u/monk)\
**Post date:** [October 31, 2018, 4:08pm UTC](https://discuss.elastic.co/t/whats-wrong-with-my-permissions/154880/1 "2018-10-31T16:08:07Z")

</div>

I installed elasticsearch using the [APT instructions here](https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html). What follows is the fun I've had since.

```
ubuntu@machine-es:~$ sudo elasticsearch
[2018-10-31T15:30:44,020][WARN][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

ubuntu@machine-es:~$ elasticsearch
/usr/share/elasticsearch/bin/elasticsearch-env: line 78: cd: /etc/elasticsearch: Permission denied

```

Ah, the instructions mention that it's all set up as root:elasticsearch. Now I add myself to the group (and forget that I have to log back in... and then that I have to restart my entire screen session...). Bus still no go:

```
ubuntu@machine-es:~$ groups
ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev lxd elasticsearch

ubuntu@machine-es:~$ elasticsearch
OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied

ubuntu@machine-es:~$ ls -ld /var/log/elasticsearch
drwxr-xr-x 2 elasticsearch elasticsearch 4096 Oct 31 15:30 /var/log/elasticsearch

```

Ah, okay:

```
sudo chmod g+w /var/log/elasticsearch/

```

Still same error.

```
ubuntu@machine-es:~$ sudo chmod a+w /var/log/elasticsearch/
ubuntu@machine-es:~$ ls -ld /var/log/elasticsearch
drwxrwxrwx 2 elasticsearch elasticsearch 4096 Oct 31 15:30 /var/log/elasticsearch
ubuntu@machine-es:~$ elasticsearch
OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied

```

I'm obviously thinking about this wrong. Did I miss something obvious in the installation and setup?

---

<div class="post-metadata">

**Author:** ![monk](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@monk](https://discuss.elastic.co/u/monk)\
**Post date:** [October 31, 2018, 4:49pm UTC](https://discuss.elastic.co/t/whats-wrong-with-my-permissions/154880/2 "2018-10-31T16:49:03Z")

</div>

A teammate points out that I shouldn't necessarily expect to be able to run it standalone, and just use it as a service. I'm still confused as to what it's complaining about, but maybe I should forget about it.

---

<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:** [October 31, 2018, 8:16pm UTC](https://discuss.elastic.co/t/whats-wrong-with-my-permissions/154880/3 "2018-10-31T20:16:53Z")

</div>

As suggested, you should use the OSs service management to start Elasticsearch, that's how it's all been configured to run when you installed it via `apt`. Anything else needs a bunch of fiddling that isn't worth it 🙂

---

<div class="post-metadata">

**Author:** ![monk](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@monk](https://discuss.elastic.co/u/monk)\
**Post date:** [October 31, 2018, 11:03pm UTC](https://discuss.elastic.co/t/whats-wrong-with-my-permissions/154880/4 "2018-10-31T23:03:50Z")

</div>

Thanks. journalctl still showed:

`Exception: /var/log/elasticsearch/elasticsearch_access.log (Permission denied) java.io.FileNotFoundException: /var/log/elasticsearch/elasticsearch_access.log (Permission denied)`

So I mucked around with permissions some more. Not sure what changed, but it started working.

---

<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, 2018, 11:03pm UTC](https://discuss.elastic.co/t/whats-wrong-with-my-permissions/154880/5 "2018-11-28T23:03:53Z")

</div>

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