I followed these instructions (in the accepted answer) for setting up permissions on my /var/www/ folder.

I'm using the www-data group as it says to use. jdownes and testuer1 are both memebers of the group.

When jdownes (or any other www-data member) creates a file in /var/www they are able to edit it just fine. If another user (testuser1) in the www-data group goes to edit and save it, they are able to save but get the following error.

enter image description here

Here are the permissions for /var/www and the permissions on the file...

enter image description here

I have root access to the server and have been setting all permissions using putty not winscp. Is the issue that the owner is not www-data for new files? If so, how can I force all new files to use www-data as the owner?

  • The images seem to be from a Windows PC? Is that correct? If so, your tags and the question are misleading. Aug 1, 2012 at 21:42
  • How are my images and tags misleading? I'm using Putty/WINSCP to access a Ubuntu web server (as such have tagged it as linux). Also, the folder /var/www is a linux directory that you typically wouldn't see in Windows.
    – flip66
    Aug 2, 2012 at 16:25

1 Answer 1


Here is what you need to do, assume www-data is the user and group apache is running at and that for /var/www the owner is you and the group is www-data:

chmod 755 /var/www
chmod g+s /var/www

The chmod g+s (set groupid) will ensure that new files will have the same group as the /var/www folder (www-data). chmod 755 /var/www ensures apache (through the www-data group) can read the folder and the user has read-write access. You need to have sufficient rights to do this.

In WinSCP set the group at least RX and user RWX and set the GID for the folder /var/www.

The reason apache fails is the missing X bit on the user and group for that folder (is 0664, should be 0755), it cannot read (= execute) the folder.

For files, 644 is sufficient: you are not required to set the GID.

  • Now testuser1 is unable to create files under /var/www... as you can see here
    – flip66
    Aug 1, 2012 at 19:02
  • Should it be the following? "chmod 775 /var/www"
    – flip66
    Aug 1, 2012 at 19:08

You must log in to answer this question.

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