Running Tomcat as www-data
|Today’s latte, Apache Tomcat. (Photo credit: yukop)|
Both php and servlet had to read and write same files. But standard configuration does not allow this as php creates files as www-data (apache user) and tomcat creates files as tomcat6 user. I searched the internet for solutions. One suggestion was to create an appropriate umask for both which I could never completely understand. Finally I realised that the easiest solution is to make tomcat run as user www-data so that all created files will have same ownership.
I found this webpage with detailed instructions on how to do this. I would like to add two more steps:
1. Edit /etc/init.d/tomcat6 also to add the user ID and group ID
2. chown var/cache/tomcat6 directory also.
|Nina Jablonski – The Evolution of Human Skin Color (Photo credit: wagnerfreeinstitute)|
BTW the application is hosted on my laptop. If you want to check it out click on the banner below if you see it. You will see it only when my laptop is on.