Allow a Tomcat9 webapp to read/write to a folder

From EN Ikoula wiki
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽

ro:Permiteți unei aplicații web Tomcat9 să citească/scrie într-un folder ru:Разрешить веб-приложению Tomcat9 читать/писать в папку pl:Zezwalaj webappom Tomcat9 na odczyt/zapis do folderu ja:Tomcat9のウェブアプリでフォルダの読み書きを可能にする zh:允许Tomcat9的web应用程序读/写一个文件夹 de:Erlauben Sie einer Tomcat9-Webapp das Lesen/Schreiben in einem Ordner nl:Sta een Tomcat9 webapp toe te lezen/schrijven naar een map it:Permettere a una webapp Tomcat9 di leggere/scrivere in una cartella pt:Permitir a leitura/escrita de uma pasta de Tomcat9 webapp es:Permitir que una aplicación web de Tomcat9 lea/escriba en una carpeta fr:Autoriser une webapp Tomcat9 à lire/écrire dans un dossier
This article has been created by an automatic translation software. You can view the article source here.

Introduction

We will see how to authorize a Tomcat9 webapp under Debian to read and write in a folder. Because under Debian the system rights are not enough for Tomcat, it is indeed put in "sandbox" mode by Systemd and has only write access to the :

   - /var/lib/tomcat9/conf/Catalina
   - /var/lib/tomcat9/logs 
   - /var/lib/tomcat9/webapps
   - /var/lib/tomcat9/work 


Course

To override this security, you have to edit the Tomcat9 configuration file of Systemd /etc/systemd/system/multi-user.target.wants/tomcat9.service, configuration file, then in the :

[Service]

Add, to for example allow access to the directory /data/ :

ReadWritePaths=/data/

Once the modification is done, you have to reload the Systemd daemon:

# systemctl daemon-reload

Then restart Tomcat9 :

# service tomcat9 restart




Cet article vous a semblé utile ?

0



You are not allowed to post comments.