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?
Asked
Active
Viewed 470 times
0

Kleber Mota
- 93
- 1
- 7
-
Is "TOMCAT9-USER" a typo? β Gerard H. Pille Apr 25 '20 at 14:39
2 Answers
0
Ubuntu nowadays mostly "works" with systemd.
Have a look at /lib/systemd/system/tomcat9.service and modify
# Security
User=tomcat
Group=tomcat
to your liking.

Gerard H. Pille
- 2,569
- 1
- 13
- 11
-
Is it not preferable to run `systemctl edit --full tomcat9` to modify `/etc/systemd/system/tomcat9.service` & leave the vendor-supplied unit file untouched? See https://unix.stackexchange.com/questions/206315/whats-the-difference-between-usr-lib-systemd-system-and-etc-systemd-system β Jimadine May 12 '23 at 09:56
0
Thanks for pointing me in this direction, I finally found out why tomcat9 would not expand the .war files (on ubuntu server 2022) in spite of the webapps_ directories having the right user/group permissions. OMG it's setting the directory permissions inside of this file as well, whose crazy idea was that? Like this we have a double administration and it took me 8 hours to get to the only right solution, which is to remove the ProtectSystem setting from this file and allow access via the normal directory attributes as has been done for ages. Come on, stop this kind of nonsense, Ubuntu.

fransrn
- 1
- 1
-
As itβs currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). β Community Jul 23 '22 at 06:00