I copy catalina.sh to /etc/init.d/tomcat and sudo chkconfig --add tomcat it started as root user,I want use another user,how?
2 Answers
If you do want to create your own start up script for whatever reason. Then to run tomcat under another user use su -c "$TOMCAT_HOME/bin/tomcat.sh start" nobody
when starting tomcat. (nobody is the user in this case that tomcat will start under)
You should not copy catalina.sh
to /etc/init.d/tomcat
. Ubuntu provides (in its tomcat6
package) a /etc/init.d/tomcat6
startup script that will invoke catalina.sh
as the correct user.
Also, using chkconfig
on Ubuntu is not supported; it's a script for Red Hat-based systems. Don't use it.