Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Tomcat and the fly likes Changing Tomcat's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Changing Tomcat Watch "Changing Tomcat New topic

Changing Tomcat's "owner"

Chris Patton

Joined: Jun 12, 2000
Posts: 7
I am currently running tomcat 4.0 on RedHat 7.3 and i was wondering if there was any way to change who owns the tomcat process. I currently have tomcat starting automatically in xinetd, because i want it to come back up if for some reason our server gets powered down.
This, however makes tomcat run as root, and i know that running any service as root is a security risk.
does anyone here know if there is a way to change who starts tomcat?
thanks for your help
- chris
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

I would think that xinetd would provide really horrible response to the first requester.
It's much better to bring up Tomcat the same way that other systems services start. That is, via the init.d services.
If you install Tomcat via the RPM, the RPM installs scripts in the /bin directory and in the /etc/init.d directory. By default, automatic startup is not enabled for security reasons. I *think* you'll also see a "tomcat4" user account get created (I know I got it somewhere!).
To activate the init script, issue the command "/sbin/chkconfig -add tomcat4". Then select the runlevels that tomcat will be up for. For example,
/sbin/chkconfig --levels 345 tomcat4 on".
You can also use the control-panel applet, but it's quicker/easier from the command line.
Tomcat config files for the RPM-installed version are under /etc/tomcat4.
Try it this way and I think you'll find that you'll be running more reliably and more securely as well!

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Changing Tomcat's "owner"
It's not a secret anymore!