PDA

View Full Version : [ubuntu] Is there any way to start tomcat service on startup as non-root?


akhan
May 18th, 2009, 05:07 PM
Is there any way to start tomcat service on startup as non-root?

-Ak

John Cheng
May 18th, 2009, 09:21 PM
Yes, if you are ok with Tomcat listening on non-privileged ports (1024+). Assuming it is installed at /opt/tomcat, you should be able to start it as a non-root user with:

/opt/tomcat/bin/startup.sh

If you are depending on the /etc/init.d/ scripts to start it, you will have to modify it so that the tomcat script runs the start command using the su -c command. For example:

su -s /bin/bash - $TOMCAT_USER -c "/opt/tomcat/bin/startup.sh"