Permission denied just after installation

I'm trying to install and run Elasticsearch and Kibana and I can't do it because every time I try, I always get some Access Permission Denied.

I'm on Ubuntu 20.04 thus installing via Debian

for example :

/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
/usr/share/elasticsearch/bin/elasticsearch-env: line 78: /etc/default/elasticsearch: Permission denied

(yeah the kibana config was created in an other folder so I have to manually change the PATH variable)

> KBN_PATH_CONF=/etc/kibana /usr/share/kibana/bin/kibana
FATAL CLI ERROR Error: EACCES: permission denied, open '/etc/kibana/kibana.yml'

chmod shows this for /etc/default/(elasticsearch)

-rw-rw----   1 elasticsearch elasticsearch   546 Nov  9 22:09 elasticsearch

Is it normal behavior?

Hi @Broot Welcome to the commuity..

can you try
sudo /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana

thank you very much it works, thus for elasticsearch commands (as create-enrollment-token) I have to use the root access (with sudo)?
But what about Kibana?
When this is the output of

> sudo KBN_PATH_CONF=/etc/kibana /usr/share/kibana/bin/kibana
Kibana should not be run as root.  Use --allow-root to continue.

Is it safe to just use --allow-root?

No don't start Kibana as root or elasticsearch...

We just need sudo for a couple commands.

How can I start Kibana, if running the program gets a "permission denied".
as in here :

> KBN_PATH_CONF=/etc/kibana /usr/share/kibana/bin/kibana
FATAL CLI ERROR Error: EACCES: permission denied, open '/etc/kibana/kibana.yml'

thank you in advance for your answer

exactly how How did you install Kibana
If you installed as a .deb or .rpm which it looks like you did .

You then start with

sudo systemctl start kibana

As described in the documentation.