How can I grant write permission to one group?
I have two users (alex
and ben
).
alex
is member of group alex
and of group consult
.
ben
is member of group ben
and of group consult
.
I want to grant read-write access to both alex
and ben
on the folder consult_documents
.
If I make alex
the owner of the directory consult_documents
and I grant 775
access to the directory consult_documents
, ben
and alex
will be able to access the folder, I think.
But will this allow ben
access to alex
's other folders as well?
If a user is in two groups, does that mean that all the members from both groups get the same permissions on all folders?
Best Answer
Granting 775 permissions on a directory doesn't automatically mean that all users in a certain group will gain
rwx
access to it. They need to either be the owner of the directory or to belong to the directory's group:So, in order to allow both alex and ben to have write access to
some_dir
, thesome_dir
directory itself must belong to theconsult
group. If that's not the case, the directory's owner (alex in your example), should issue the following command:or to change group ownership of everything inside the directory:
This will only work if alex is a member of the
consult
group, which seems to be the case in your example.This will not allow ben to access all of alex's directories for two reasons:
consult
groupconsult
group but alex may not have chosen to allowrwx
group access to them.In short, the answer depends both on group ownership and on the group permission bits set for the directory.
All of this is provided you don't use any additional mandatory access control measures on your system.