less than 1 minute read

How to grant Tomcat 9 access on other files

Sometime you will need to access files from the tomcat either the in the same directory or other directories. This need to configure from Linux side without any configuration to the Tomcat

Steps

Add the tomcat to a group and grant this group to the required access to that files, by creating a group called webserver. Then restart tomcat and try again

sudo groupadd webserver
sudo usermod -a -G webserver tomcat9
sudo chgrp webserver configuration.yaml
sudo chmod g=rw configuration.yaml
sudo systemctl restart tomcat9

, Update the group ownership of the directories add permission to the group

sudo chgrp webserver /opt/internal/data/
sudo chgrp webserver /opt/internal/
sudo chmod g=rwx /opt/internal/data/
sudo chmod g=rwx /opt/internal/

Comments