Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to change the user tomcat runs, to www-data?

I tried the same thing as How to run tomcat6 on ubuntu as root? but it doesnt cause any changes.

share|improve this question
how did you install tomcat? – Mike Jun 28 '12 at 12:28
apt-get install tomcat6 – aitchnyu Jun 28 '12 at 12:29
up vote 3 down vote accepted

Here is how I just did it with tomcat6 installed..

I first stopped tomcat from running

/etc/init.d/tomcat6 stop

Changed the following in


To be the following

# Run Tomcat as this user ID. Not setting this or leaving it blank will use the
# default of tomcat6.

# Run Tomcat as this group ID. Not setting this or leaving it blank will use
# the default of tomcat6.

Then I had to change ownership of the log directory

chown -R www-data: /var/log/tomcat6
chown -R www-data: /usr/lib/tomcat6
chown -R www-data: /etc/tomcat6

Then I was able to run tomcat6

/etc/init.d/tomcat6 start

See the results

# ps aux | grep tomcat
www-data 26436 11.3  0.7 559552 58464 ?        Sl   05:34   0:01 /usr/lib/jvm/java-6-openjdk/bin/java -Djava.util.logging.config.file=/var/lib/tomcat6/conf/ -Djava.awt.headless=true -Xmx128M -XX:+UseConcMarkSweepGC -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -classpath /usr/share/tomcat6/bin/bootstrap.jar -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 org.apache.catalina.startup.Bootstrap start
share|improve this answer
There were silent failures till I set the ownership of /usr/lib/tomcat6 and /etc/tomcat6 . Only then Tomcat served my application. Please include these crucial pieces. – aitchnyu Jun 28 '12 at 13:19
edited.. thanks – Mike Jun 28 '12 at 14:59
same for /var/cache/tomcat6/. Tomcat will complain about an unwritable scratch dir – aitchnyu Jun 30 '12 at 5:31

Your Answer


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.