I want run tomcat9 with a user different from the default, and searching the web, I found out that I can configure this in the file /etc/default/tomcat
. In this file, I change the lines with TOMCAT9-USER
and TOMCAT9_GROUP
and change to the desired user and group I wish tomcat9 was running under. After that, I stop tomcat, and start again (I've trie restart too), but when I run ps -ef
, tomcat still is displayed running under user tomcat. What I am doing wrong here? Is there any other file I need modify?
Tomcat9 keep running under user tomcat9 even after change in /etc/default/tomcat9 file
1.7k Views Asked by Kleber Mota At
3
There are 3 best solutions below
0

[Originally this answer appeared under How do I run Tomcat 9 as a different user, which is a duplicate of this question]
The Tomcat 9 packages based on Debian 10 use SystemD to run. Therefore you need to run:
sudo systemctl edit tomcat9.service
(or create a file named /etc/systemd/system/tomcat9.service.d/override.conf
) and type:
[Service]
User=your_user
Group=your_group
in the editor that appears. Check the systemd.exec manual for more options or see the vendor supplied unit file (/lib/systemd/system/tomcat9.service
).
When you restart your server, it will use the new settings.
Try using service.bat or service.sh to set the user which the tomcat process need to run as.
Try to follow the below Tomcat 9 documentation
https://tomcat.apache.org/tomcat-9.0-doc/windows-service-howto.html