Running as ROOT user this is a bad idea – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 2.3-2.3

Briefly, this error occurs when Elasticsearch is being run as a ROOT user, which is not recommended due to potential security risks and data corruption. To resolve this issue, you should create a non-root user specifically for Elasticsearch. You can do this by using the ‘adduser’ command in Linux. Then, change the ownership of the Elasticsearch directory to the new user. Finally, ensure that Elasticsearch is started with the new non-root user.

This guide will help you check for common problems that cause the log ” running as ROOT user. this is a bad idea! ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: bootstrap.

Log Context

Log “running as ROOT user. this is a bad idea!” classname is Bootstrap.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

         final ESLogger logger = Loggers.getLogger(Bootstrap.class);

        // check if the user is running as root; and bail
        if (Natives.definitelyRunningAsRoot()) {
            if (Boolean.parseBoolean(System.getProperty("es.insecure.allow.root"))) {
                logger.warn("running as ROOT user. this is a bad idea!");
            } else {
                throw new RuntimeException("don't run elasticsearch as root.");
            }
        }





 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?