Allow group to r/w in folder owned by a specific user

This is quite special and you could not manage this by using the legacy permissions architecture of an unixoid system. The closest approach to your intention is using ACLs. Issue the following command (optionally as superuser):

setfacl -d -R -m g:manager:rwx /dir/of/user1
setfacl -R -m g:manager:rwx /dir/of/user1

The first command sets the default permissions to the directory so that they apply to newly created files (by user1). The second command sets the actual rights of the folders and files recursively.

Note, that the ACL infrastructure does not apply to the Apache Webserver. Apache only cares about the legacy permissions (user/group/others permission). So inside the webfolder every file/folder must be in the www-data group and every file must have at least read permissions for www-data. Folders should have the execute permissions for www-data for the Index searching.

Update:

To force the newly created files inside a directory to inherit the group of this directory set the gid bit of the directory:

chmod g+s /web/directory

Newly created files inside /web/directory will then inherit the group of /web/directory


In addition to being part of the group, you have to set write permission on the directory:

 chmod 770 /var/www/user1Project/example_dir

(use 775 if you want the world to have read permission, which is more likely on a web directory).

Also realise that the user manager has to re-login after being added to the group user1.

If you want every directory created by user1 to be writeable by the group members of group user1, you can set:

umask 0002

which will result in directories created with permissions rwxrwxr-x.


Set directory group to manager:

chgrp -hR manager /your/target/directory/path

And then, add set-GID-bit to your permission, so if user1 changes anything, the group will be able to write again:

chmod g+s /your/target/directory/path