0

I followed the most upvoted tips in this thread.

What's the best way of handling permissions for Apache 2's user www-data in /var/www?

I just made a new file under one user1. However user2 cannot edit it. The files that were all there before I made these permission changes however, both users could edit. I don't want to do the find command every time we make new files. Am I missing something?

Ramin
  • 113
  • 3

1 Answers1

2

Make sure user2 has been added to the same group as user1:

grep user2 /etc/group

Should return something like:

user1:502:user2,user3

Ensure that there are write permissions on the parent directory:

chmod g+w mydir

Finally add a sticky bit to said directory:

chmod g+s mydir

If you want further help, you would need to post the output of ls -lhad mydir for the specific parent directory you are having problems modifying files in and the group information for user1 and user2 in /etc/groups (as posted above). You can also check out this CentOS Guide, it's written for CentOS 5 but is still applicable for most distros. You can also use the following command to add write permissions for all files and directories within a specific parent directory (so mydir/myfile gets group write access as well):

chmod -R g+w mydir

  • The other answers didn't really do it for me unfortunately. However, my issues were solved with the following Access Control List (ACL) command: setfacl -Rm d:g:mygroup:rwx /var/www Which was based off of this answer from http://serverfault.com/a/7076/252902. I also took advantage of the CentOS link you put up here so thank you for that. Another useful link is http://bencane.com/2012/05/27/acl-using-access-control-lists-on-linux/ – Ramin Nov 10 '14 at 06:10