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

I'm struggling with this. Lets assume the following:

A user named 'deploy' has a directory in his home directory called In it, there are a number of files and their permissions are set like so:

drwxrwxrwx 6 deploy deploy 4096 2010-02-10 21:06

There is also a fresh installation of apache 2 running as www-data:www-data.

I need the files to remain owned by deploy:deploy but I need apache to be able to write to those files.

Shouldn't adding www-data to the deploy group or vice versa, allow apache to write to the directory?

My /etc/groups file shows (Truncated for brevity):


Yet the www-data user can't write to the directory. It's driving me crazy! Help?

share|improve this question

migrated from Feb 12 '10 at 1:19

This question came from our site for professional and enthusiast programmers.

You should be asking this on ServerFault - see the links at the bottom of this page. – Neil Butterworth Feb 10 '10 at 21:59

I think the www-data user needs at least read and execute permissions on the parent directory, if not the whole directory path. If the user's home directory is restricted to, say, 700 (drwx------) then that would block group writes in the child directory too. Of course, changing the home directory could have other implications (e.g. for ssh) so you might be better off putting the user's directory under the Apache htdocs area - which potentially reverses the problem, though you've already got the group setup.

share|improve this answer

Recursively assignment to www-data as owner of the stuff, not just the top folder. It should do

share|improve this answer

To test your setup you may use

$ sudo -- su -c "ls -l /home/deploy/" www-data

or even

$ sudo -- su -c "touch /home/deploy/" www-data

to see if you can write to that directory as www-data.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.