I've an issue with files ownerships.

I have a drupal website and the "files" folder needs to be owned by "www-data" in order to let the users to upload files with php.

However I'm now using svn and I need all folders and files to be own by "svnuser" in order to work.

So now, I guess I need to add both users to a group with proper permissions. I'm not sure what exactly to do, could you tell me what are the exact necessary steps?



There is also a group called www-data. The files you have in your webroot should all belong to that group and have write-right for the group. Assuming your webroot is /var/www you can do this by executing (as root or by using sudo)

chgrp -R www-data /var/www
chmod -R g+rwX /var/www
  • It seems that the changing the grp is not the solution. It depends on the owner. If the owner is www-data than I cannot commit such files, if the owner is svnuser than I cannot upload files into the folders with php. – aneuryzm Jan 4 '11 at 18:45
  • Should I maybe create a group and add both users ? Is this the best solution ? – aneuryzm Jan 4 '11 at 18:45
  • The user www-data is automatically a member of the group www-data. You could add the svnuser to that group as well. But if the group has write-permission on the directory (and its subdirectories) the www-data user should be able to upload files to that directory. – Carsten Thiel Jan 4 '11 at 19:04
  • I've added svnuser to www-data and the www-data group has all permissions over files, but still it gives me an error. The svnuser is actually my Ubuntu username, so probably svn doesn't use the group instead. – aneuryzm Jan 5 '11 at 8:17
  • I've also tried to change owner to svn-data, but then the webserver cannot upload files. This is strange, because the files still are under www-data group which has all permissions (775) – aneuryzm Jan 5 '11 at 8:26

Is this link helpful? Geek Thoughts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.