Permission denied when running elasticsearch


(apanimesh061) #1

I downloaded ES 2.1.0 as ran using the shell script available in bin folder.

animesh@ubuntu:~/Documents/elasticsearch-2.1.0/bin$ sudo ./elasticsearch
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.

and if I run elasticsearch not as root:

animesh@ubuntu:~/Documents/elasticsearch-2.1.0/bin$ ./elasticsearch
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /home/animesh/Documents/elasticsearch-2.1.0/logs/elasticsearch.log (Permission denied)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
	at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
	at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
	at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223)
	at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
	at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
	at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
	at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842)
	at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
	at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)
	at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)
	at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:440)
	at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:128)
	at org.elasticsearch.bootstrap.Bootstrap.setupLogging(Bootstrap.java:204)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:258)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
log4j:ERROR Either File or DatePattern options are not set for appender [file]. ........
.
.
.
.

How should I correct those errors?

I am using Ubuntu 12.04.


(David Pilato) #2

Something like?

chown -R youruser:yourgroup /home/animesh/Documents/elasticsearch-2.1.0

#3

I have a similar issue and I've tried to play with permissions/folder ownership and it would not work.

I'm getting similar error : main ERROR Unable to create file /var/log/elasticsearch/elasticsearch.log java.io.IOException: Permission denied

And there are more lines to it but that seems to be the problem.

I ended up removing elasticsearch and reinstalling it and removing elasticsearch folder from /var/log but it still did not fix the issue. Any suggestions?

What should be done to /var/log directory itself?

Thanks a lot


(system) #4