• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to setup Tomcat to run as user and daemon in Lunix/Redhat ?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following:
* A redhat box running Fedora release 7 (Moonshine)
* Tomcat apache-tomcat-6.0.18 distribution

Currently, Apache is setup to work with Tomcat using the AJP connector, that works fine.

When I boot the box I su root and then I run the script startup.sh which is on the bin directory of tomcat, that starts tomcat without a problem. I can close my root session, my ssh and tomcat keeps running.

The problem is that running as root is a huge security problem. I run multiple virtual hosts in tomcat and although all sites are developed by me, I want to prevent any webapp from causing any harm such as:

* System.exit() which will shutdown Tomcat
* writing to secure directories
* practically control the box!

I need to be able to run tomcat as user not as root and also as a daemon on start up so that I don't need to manually start it.

Any help on the subject will be much appreciated!
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, JC!

There have been a couple of RPMs created that will do what you want (I've even built one or 2 myself). What they do is create a user/group named tomcat, install an init script, and alias over the work, temp and config files to the standard LSB locations (/var, /tmp and /etc).

There was (is?) a French site that contained a wealth of packages for Java. In fact, it's biggest fault was that it had a separate Java package for almost everything you could think of. But it included a Tomcat RPM. Sometimes it was more up-to-date than others.

Red Hat Enterprise Linux provides a set of tomcat RPMs, as does its free port, CentOS. You can probably install them in Fedora if you hammer on them a little.
 
reply
    Bookmark Topic Watch Topic
  • New Topic