title: Elasticsearch: Change permissions of old folder index to work with yum-installed elasticsearch
body: <p>I used a specific library that used an embedded version of elasticsearch. Now as we are growing, I want to start elasticsearch as a service.</p>
  
  <p>I followed <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html#_yum_dnf" rel="nofollow">this guide</a> to install it using <code>yum</code> on a linux machine. I pointed ES to the new directory using </p>
  
  <pre><code>path:
      logs: /home/ec2-user/.searchindex/logs
      data: /home/ec2-user/.searchindex/data
  </code></pre>
  
  <p>When I start the service</p>
  
  <pre><code>sudo service elasticsearch start
  </code></pre>
  
  <p>I get a permission denied error:</p>
  
  <pre><code>java.io.FileNotFoundException: /home/ec2-user/.searchindex/logs/elasticsearch_index_search_slowlog.log (Permission denied)
      at java.io.FileOutputStream.open0(Native Method)
  ....
  </code></pre>
  
  <p>I guess this has to do with the folder permission, I changed folder permission using:</p>
  
  <pre><code>sudo chown elasticsearch:elasticsearch -R .searchindex
  </code></pre>
  
  <p>But that didn't help.</p>
  
  <p>Any help?</p>