Elasticsearch cannot open log file: Permission denied

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0















The error



I installed Elasticsearch on CentOS using rpm and am encountering this error when I try to start it via systemctl start elasticsearch:



Feb 20 21:08:34 server.cberdata.org systemd[1]: Started Elasticsearch.
Feb 20 21:08:34 server.cberdata.org elasticsearch[4226]: OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied
Feb 20 21:08:51 server.cberdata.org systemd[1]: elasticsearch.service: main process exited, code=exited, status=78/n/a
Feb 20 21:08:51 server.cberdata.org systemd[1]: Unit elasticsearch.service entered failed state.
Feb 20 21:08:51 server.cberdata.org systemd[1]: elasticsearch.service failed.


Notably: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied




Permissions



Permissions for /var:



drwxr-xr-x 21 root root 4096 Feb 11 19:10 var


Permissions for /var/log:



drwxrwxr-- 12 root root 4096 Feb 20 21:00 log


Permissions for /var/log/elasticsearch:



drwxrwxrwx 2 elasticsearch elasticsearch 4096 Feb 20 20:56 elasticsearch


Permissions for /var/log/elasticsearch/gc.log

(which I manually created to see if that would help, but doing so had no effect on the error):



-rwxrwxrwx 1 elasticsearch elasticsearch 0 Feb 20 20:56 gc.log


Setting /var/log permissions to drwxrwxrwx appears to fix the problem, but I'm hesitant to do that because it seems insecure and it results in these new errors:



/etc/cron.daily/logrotate:
error: skipping "/var/log/exim_mainlog" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.



Am I correct that systemctl / systemd is running this service as the elasticsearch user? If it's doing that, how can the owner of the file and its directory, with apparent read/write/execute permissions, not have permission to open that file?










share|improve this question




























    0















    The error



    I installed Elasticsearch on CentOS using rpm and am encountering this error when I try to start it via systemctl start elasticsearch:



    Feb 20 21:08:34 server.cberdata.org systemd[1]: Started Elasticsearch.
    Feb 20 21:08:34 server.cberdata.org elasticsearch[4226]: OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied
    Feb 20 21:08:51 server.cberdata.org systemd[1]: elasticsearch.service: main process exited, code=exited, status=78/n/a
    Feb 20 21:08:51 server.cberdata.org systemd[1]: Unit elasticsearch.service entered failed state.
    Feb 20 21:08:51 server.cberdata.org systemd[1]: elasticsearch.service failed.


    Notably: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied




    Permissions



    Permissions for /var:



    drwxr-xr-x 21 root root 4096 Feb 11 19:10 var


    Permissions for /var/log:



    drwxrwxr-- 12 root root 4096 Feb 20 21:00 log


    Permissions for /var/log/elasticsearch:



    drwxrwxrwx 2 elasticsearch elasticsearch 4096 Feb 20 20:56 elasticsearch


    Permissions for /var/log/elasticsearch/gc.log

    (which I manually created to see if that would help, but doing so had no effect on the error):



    -rwxrwxrwx 1 elasticsearch elasticsearch 0 Feb 20 20:56 gc.log


    Setting /var/log permissions to drwxrwxrwx appears to fix the problem, but I'm hesitant to do that because it seems insecure and it results in these new errors:



    /etc/cron.daily/logrotate:
    error: skipping "/var/log/exim_mainlog" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.



    Am I correct that systemctl / systemd is running this service as the elasticsearch user? If it's doing that, how can the owner of the file and its directory, with apparent read/write/execute permissions, not have permission to open that file?










    share|improve this question


























      0












      0








      0








      The error



      I installed Elasticsearch on CentOS using rpm and am encountering this error when I try to start it via systemctl start elasticsearch:



      Feb 20 21:08:34 server.cberdata.org systemd[1]: Started Elasticsearch.
      Feb 20 21:08:34 server.cberdata.org elasticsearch[4226]: OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied
      Feb 20 21:08:51 server.cberdata.org systemd[1]: elasticsearch.service: main process exited, code=exited, status=78/n/a
      Feb 20 21:08:51 server.cberdata.org systemd[1]: Unit elasticsearch.service entered failed state.
      Feb 20 21:08:51 server.cberdata.org systemd[1]: elasticsearch.service failed.


      Notably: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied




      Permissions



      Permissions for /var:



      drwxr-xr-x 21 root root 4096 Feb 11 19:10 var


      Permissions for /var/log:



      drwxrwxr-- 12 root root 4096 Feb 20 21:00 log


      Permissions for /var/log/elasticsearch:



      drwxrwxrwx 2 elasticsearch elasticsearch 4096 Feb 20 20:56 elasticsearch


      Permissions for /var/log/elasticsearch/gc.log

      (which I manually created to see if that would help, but doing so had no effect on the error):



      -rwxrwxrwx 1 elasticsearch elasticsearch 0 Feb 20 20:56 gc.log


      Setting /var/log permissions to drwxrwxrwx appears to fix the problem, but I'm hesitant to do that because it seems insecure and it results in these new errors:



      /etc/cron.daily/logrotate:
      error: skipping "/var/log/exim_mainlog" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.



      Am I correct that systemctl / systemd is running this service as the elasticsearch user? If it's doing that, how can the owner of the file and its directory, with apparent read/write/execute permissions, not have permission to open that file?










      share|improve this question
















      The error



      I installed Elasticsearch on CentOS using rpm and am encountering this error when I try to start it via systemctl start elasticsearch:



      Feb 20 21:08:34 server.cberdata.org systemd[1]: Started Elasticsearch.
      Feb 20 21:08:34 server.cberdata.org elasticsearch[4226]: OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied
      Feb 20 21:08:51 server.cberdata.org systemd[1]: elasticsearch.service: main process exited, code=exited, status=78/n/a
      Feb 20 21:08:51 server.cberdata.org systemd[1]: Unit elasticsearch.service entered failed state.
      Feb 20 21:08:51 server.cberdata.org systemd[1]: elasticsearch.service failed.


      Notably: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied




      Permissions



      Permissions for /var:



      drwxr-xr-x 21 root root 4096 Feb 11 19:10 var


      Permissions for /var/log:



      drwxrwxr-- 12 root root 4096 Feb 20 21:00 log


      Permissions for /var/log/elasticsearch:



      drwxrwxrwx 2 elasticsearch elasticsearch 4096 Feb 20 20:56 elasticsearch


      Permissions for /var/log/elasticsearch/gc.log

      (which I manually created to see if that would help, but doing so had no effect on the error):



      -rwxrwxrwx 1 elasticsearch elasticsearch 0 Feb 20 20:56 gc.log


      Setting /var/log permissions to drwxrwxrwx appears to fix the problem, but I'm hesitant to do that because it seems insecure and it results in these new errors:



      /etc/cron.daily/logrotate:
      error: skipping "/var/log/exim_mainlog" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.



      Am I correct that systemctl / systemd is running this service as the elasticsearch user? If it's doing that, how can the owner of the file and its directory, with apparent read/write/execute permissions, not have permission to open that file?







      permissions elasticsearch






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 20 at 22:59









      Rui F Ribeiro

      41.5k1483140




      41.5k1483140










      asked Feb 20 at 21:27









      Phantom WatsonPhantom Watson

      1064




      1064




















          1 Answer
          1






          active

          oldest

          votes


















          3














          The directory /var/log has 774 permissions. As the execute bit isn't set, the elasticsearch user can't traverse the directory to get the elasticsearch directory and the gc.log file contained therein.



          Normally, the /var/log directory has 755 permissions or else no services or applications running as anyone other than root would be able to write to it.



          You can fix it by using:



          chmod 755 /var/log


          You also don't need to have 777 permissions on the elasticsearch directory and the log file. The can use a variation of the above command to set the permissions:



          chmod -R 755 /var/log/elasticsearch





          share|improve this answer























          • That worked! I forgot that execute is needed for directory traversal. Thanks, Nasir!

            – Phantom Watson
            Feb 20 at 22:11











          • @PhantomWatson You are welcome.

            – Nasir Riley
            Feb 20 at 22:12










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f501963%2felasticsearch-cannot-open-log-file-permission-denied%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          The directory /var/log has 774 permissions. As the execute bit isn't set, the elasticsearch user can't traverse the directory to get the elasticsearch directory and the gc.log file contained therein.



          Normally, the /var/log directory has 755 permissions or else no services or applications running as anyone other than root would be able to write to it.



          You can fix it by using:



          chmod 755 /var/log


          You also don't need to have 777 permissions on the elasticsearch directory and the log file. The can use a variation of the above command to set the permissions:



          chmod -R 755 /var/log/elasticsearch





          share|improve this answer























          • That worked! I forgot that execute is needed for directory traversal. Thanks, Nasir!

            – Phantom Watson
            Feb 20 at 22:11











          • @PhantomWatson You are welcome.

            – Nasir Riley
            Feb 20 at 22:12















          3














          The directory /var/log has 774 permissions. As the execute bit isn't set, the elasticsearch user can't traverse the directory to get the elasticsearch directory and the gc.log file contained therein.



          Normally, the /var/log directory has 755 permissions or else no services or applications running as anyone other than root would be able to write to it.



          You can fix it by using:



          chmod 755 /var/log


          You also don't need to have 777 permissions on the elasticsearch directory and the log file. The can use a variation of the above command to set the permissions:



          chmod -R 755 /var/log/elasticsearch





          share|improve this answer























          • That worked! I forgot that execute is needed for directory traversal. Thanks, Nasir!

            – Phantom Watson
            Feb 20 at 22:11











          • @PhantomWatson You are welcome.

            – Nasir Riley
            Feb 20 at 22:12













          3












          3








          3







          The directory /var/log has 774 permissions. As the execute bit isn't set, the elasticsearch user can't traverse the directory to get the elasticsearch directory and the gc.log file contained therein.



          Normally, the /var/log directory has 755 permissions or else no services or applications running as anyone other than root would be able to write to it.



          You can fix it by using:



          chmod 755 /var/log


          You also don't need to have 777 permissions on the elasticsearch directory and the log file. The can use a variation of the above command to set the permissions:



          chmod -R 755 /var/log/elasticsearch





          share|improve this answer













          The directory /var/log has 774 permissions. As the execute bit isn't set, the elasticsearch user can't traverse the directory to get the elasticsearch directory and the gc.log file contained therein.



          Normally, the /var/log directory has 755 permissions or else no services or applications running as anyone other than root would be able to write to it.



          You can fix it by using:



          chmod 755 /var/log


          You also don't need to have 777 permissions on the elasticsearch directory and the log file. The can use a variation of the above command to set the permissions:



          chmod -R 755 /var/log/elasticsearch






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 20 at 22:03









          Nasir RileyNasir Riley

          2,8122410




          2,8122410












          • That worked! I forgot that execute is needed for directory traversal. Thanks, Nasir!

            – Phantom Watson
            Feb 20 at 22:11











          • @PhantomWatson You are welcome.

            – Nasir Riley
            Feb 20 at 22:12

















          • That worked! I forgot that execute is needed for directory traversal. Thanks, Nasir!

            – Phantom Watson
            Feb 20 at 22:11











          • @PhantomWatson You are welcome.

            – Nasir Riley
            Feb 20 at 22:12
















          That worked! I forgot that execute is needed for directory traversal. Thanks, Nasir!

          – Phantom Watson
          Feb 20 at 22:11





          That worked! I forgot that execute is needed for directory traversal. Thanks, Nasir!

          – Phantom Watson
          Feb 20 at 22:11













          @PhantomWatson You are welcome.

          – Nasir Riley
          Feb 20 at 22:12





          @PhantomWatson You are welcome.

          – Nasir Riley
          Feb 20 at 22:12

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f501963%2felasticsearch-cannot-open-log-file-permission-denied%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown






          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?