Setting group automatically upon file creation (local web development configuration)
I'm in the process of setting up my Ubuntu box with a web development configuration that will allow me to edit web sites under my local non-root account (jonathan), while also allowing the local Apache server (www-data) to access, and maybe modify, these sites.
The sites are hosted in a subdirectory within my home directory, and for each website I set up a soft link from /var/www/<sitename> to this directory so that I can keep track of the sites on the machine.
I've set up a new group called web on the machine, and added the users jonathan and www-data to this group. The directory for each website will have read/write access for jonathan (for the purpose of editing the site), and read access for the web group with write access where applicable (so that Apache can serve it). Therefore, my web apps won't scrub the entire site in the event of anything going wrong.
The main problem I'm having here is that I'm not sure how to get the system to automatically set newly created files to group "web", as opposed to group "jonathan". Further to this, it would be nice if the system could set the group to "jonathan" upon file creation outside my website directories, and "web" when inside my website directories.
I'd also like any feedback if possible on my overall approach to this - hence the hefty amount of background info!