Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm well aware that running tomcat6 is really bad from a security point of view - and opens the box it is running on to all kinds of security risks and attack vectors. That said:

When I change the entry in the /etc/init.d/tomcat6 to

TOMCAT6_USER=root

and then run

sudo /etc/init.d/tomcat6 start

I get

[fail]

and nothing is written to the logs under /var/log/tomcat6 and no entry for tomcat6 is created under /var/run

How do I diagnose what is going wrong?


Additional - note that catalina.err and catalina.out have not been created.

The reason you'd want to do this is because (a) this is a virtual machine running on a dev box and (b) it executes a process in a chroot jail which will only run if executed by a root (c) the process that runs in the chroot jail is a software package which has been obtained from an external

share|improve this question

2 Answers 2

Running Tomcat is no more insecure directly than running any other application server.

It's more down to common sense security concepts that will make your box safe. You should definitely be using some sort of firewall, especially if your box is public facing.

If your deployed application is insecure and vulnerable to SQL injection, then not even the most expensive servlet container is going to save you, you just have crappy code.

Don't run tomcat6 as root. I can't for the life of me imagine why you'd need/want to do this, and if you have "permissions problems" then You're Doing It Wrong.

I have maintained (and continue to maintain) a number of tomcat 5 and 6 servers running as their respective tomcat users, with no problem deploying webapps. Running servers as root is just too large a security risk, and often a totally unnecessary one.

If you really want to get to the bottom of it, the catalina.out and catalina.err files will probably have more information, but I think running as root is a potentially lethal idea, so I'd probably leave it as the default tomcat system user.

share|improve this answer
1  
+1, never run as root. If you really need to execute another process from your webserver, there are other options - compile a stub that runs as root, create a daemon and communicate with it etc. Don't go the easiest way just because that the first thing you think about. To answer the original question: You can diagnose what you do wrong by looking at your post: "TOMCAT_USER=root" is what is going wrong. Seriously. Really really seriously. –  Olaf May 1 '10 at 12:21
up vote 1 down vote accepted

The question being asked here appears to be - how would you debug a shell script to see what is going on - to do that you'd run it as:

sudo bash -x -v /etc/init.d/tomcat6 start

and read the output to see what is going on.

It actually looks like Ubuntu has been set up not to allow this easily. A whole load of directories have been set to ownership by the tomcat6 user only (ie not the root user). To see which ones they are - run the command

find / -user tomcat6

For the sake of respecting the intents of the Ubuntu/Tomcat6 packagers for security purposes - I'm not going to publish what you'd do after this.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.