Skript for running elasticsearch from command line / bin


I needed to install a different instance of elasticsearch-6.2.4 with .tar.gz on our debian server. We are almost always accessing our servers with root user. Elasticsearch cannot be run as root. It would be verry annoying, though, always having to switch user for starting Elasticsearch.

I tried adapting the directory variables of the init.d file from the Debian package and just running it. I am not very familiar with init.d scripts. It gives me the error "mktemp: failed to create directory via template `/tmp/elasticsearch.XXXXXXXX': Permission denied"

What would be the best way starting Elasticsearch from root user but not as root user? Is using the init.d file possible?

Thank you

This is a dangerous practice. In general, you want to use a user with the minimal privileges necessary to execute the task at hand.

If you insist on doing this, you can do su elasticsearch ./bin/elasticsearch.

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