I have a group
manager
and an useruser1
.
user1
will create a directory by example in the webserver path/var/www/user1Project
.How to allow the group
manager
to r/w in any directory owned byuser1
?I already tried to add group
manager
touser1
. But it did not solved my problem. A user frommanager
group is not allowed to write inuser1Project
. I do not know why.
Answer
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
Attribution
Source : Link , Question Author : Atnaize , Answer Author : fragwürdig