What's wrong with my permissions?


(Aditya Prasad) #1

I installed elasticsearch using the APT instructions here. 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?


(Aditya Prasad) #2

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.


(Mark Walkom) #3

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 :slight_smile:


(Aditya Prasad) #4

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.


(system) #5

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