Elasticsearch directory permission

I just installed elasticsearch 7.12.0 rpm package on AWS Linux AMI, when I try to access the config directory, it says "permission denied".

this is the directory detail.
$ ls -l
drwxr-s--- 3 root elasticsearch 245 Mar 27 21:42 elasticsearch

I need help accessing it via the same or some specific user which I think in this case is 'elasticsearch'.

this command asks for password which I don't know;
$ su elasticsearch

What directory are you exactly trying to access?


I want to access the config file actually.

What command did you use to install?

If you used sudo to install the package.


sudo vi /etc/elasticsearch/elasticsearch.yml

Of just

sudo -i

Then the commands you want


$ sudo -i
$ cd /etc/elasticsearch
$ vi elasticsearch.yml
1 Like

If you are not created the user elasticsearch , you cant switch user to elasticsearch ( su elasticsearch not possible)

for avoid this permission denied error try this command as root

sudo chown elasticsearch:elasticsearch /etc/elasticsearch

Thanks, I was able to access the config with sudo {path to yml}.

Hi Rijin,

Will there be any effect on elasticsearch service or user if I change owner of the directory?

The ownerships are set for a reason, so if you change them to something else yes it could have a negative affect.

1 Like

In My experience ownership change helped to avoid permission issues .

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