Super User is a question and answer site for computer enthusiasts and power users. 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

I am in a messy situation that involves Apache and Tomcat 6. I serve PHP projects with Apache.

I use Tomcat to run Solr, a RESTful interface for search. I place the Solr index within the PHP application. This is helpful as all the code and data associated with a project is stored in a single directory. And it works without a hitch in our Windows development machines.


But it gets tricky in my Linode Ubuntu VPS. I log in as root using SSH and all files I write in that session are owned by root. But then,

  1. all PHP directories need to be readable and writable by www-data, which Apache runs as.
  2. the Solr indexes need to readable and writable by tomcat6, which Tomcat runs as.

Hence, my flow to deploy a new project:

  1. Log in as root with SSH and copy files to www
  2. use chown to make the project owned by www-data
  3. use chown to make the Solr index subdirectory owned by tomcat6

The obvious way to make this straightforward is to create a new user xx, and run Apache and Tomcat as xx and upload to SSH as xx. What is a good solution so that I can simply upload the files so that both Apache and Tomcat can use it straightaway without any further settings?

share|improve this question
up vote 2 down vote accepted

Put www-data and tomcat6 in the same group and add your user (or root) to that group. sg and umask so files you copy get the correct group and are g+rw.

share|improve this answer
    
After making the group make the www folder group sticky. This along with the common group and umask will make it very easy to manage the permissions. – Lamar B Oct 3 '11 at 16:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .