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?