如何使Ubuntu 11.10上的Tomcat6作为www-data运行?

如何更改tomcat运行的用户到www-data?

我尝试了如何以root身份在ubuntu上运行tomcat6? 但它不会导致任何更改。

这里是我刚刚做的与tomcat6安装..

我第一次停止运行tomcat

 /etc/init.d/tomcat6 stop 

更改了以下内容

 /etc/default/tomcat6 

为了以下

 # Run Tomcat as this user ID. Not setting this or leaving it blank will use the # default of tomcat6. TOMCAT6_USER=www-data # Run Tomcat as this group ID. Not setting this or leaving it blank will use # the default of tomcat6. TOMCAT6_GROUP=www-data 

然后我不得不改变日志目录的所有权

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

然后我能够运行tomcat6

 /etc/init.d/tomcat6 start 

查看结果

 # 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/logging.properties -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 -Djava.io.tmpdir=/tmp/tomcat6-tmp org.apache.catalina.startup.Bootstrap start