Permission denied Can't run elasticsearch


(Applicate) #1

Lenovo-G50-80:/usr/share/elasticsearch$ bin/elasticsearch
bin/elasticsearch-env: line 70: /etc/default/elasticsearch: Permission denied


#2

Can you do an ls -l on the directory and make sure it is owned by elasticsearch:elasticsearch?


(Applicate) #3

Here it is
Lenovo-G50-80:/usr/share/elasticsearch$ ls -l
total 216
drwxr-xr-x 3 root root 4096 May 17 20:09 bin
drwxr-xr-x 2 root root 4096 May 17 20:09 lib
drwxr-xr-x 16 root root 4096 May 17 20:09 modules
-rw-r--r-- 1 root root 191887 Apr 13 02:09 NOTICE.txt
drwxr-xr-x 2 root root 4096 Apr 13 02:09 plugins
-rw-r--r-- 1 root root 9268 Apr 13 02:09 README.textile


#4

That is your problem.
please run this command

sudo chown -R elasticsearch:elasticsearch /usr/share/elasticsearch


(Applicate) #5

Did not work.


#6

are you running elastisearch as the user? Ifnot, try sudo bin/elasticsearch


(Applicate) #7

[2018-05-17T21:05:43,604][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.4.jar:6.2.4]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.2.4.jar:6.2.4]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.4.jar:6.2.4]
... 6 more
Lenovo-G50-80:/usr/share/elasticsearch$ curl http://localhost:9200/
curl: (7) Failed to connect to localhost port 9200: Connection refused


(R_C) #8

Elasticsearch cannot run from root when build from source .
If you are logged in via user "Lenovo-G50-80" try -
sudo chown -R Lenovo-G50-80:Lenovo-G50-80 /usr/share/elasticsearch
and then execute .

Also enable ports 9200 and 9300 .


(system) #9

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