Changing acl permissions of user1 home directory so nongroup member can access it while group members cannot

0

I have several users in several different groups. So...

sudo su

>$ ls -l /home/
drwxr-x---   5 root   group1         4096 Mar 18 12:44 group1
drwxr-x---   6 root   group2         4096 Feb  9 13:58 group2

>$ ls -l /home/group1
drwx------ 6 user1 group1 4096 Mar 23 15:57 user1
drwx------ 6 user2 group1 4096 Mar 23 12:19 user2

Now user3 is a member of group2. I want user3 to be able to read and execute user1's home directory but I don't want to permit user2 (who is in the same group as user1) to have any permissions to user1's home directory.

If I try using acl's.

>$ getfacl /home/group1/user1
# file: user1/
# owner: user1
# group: group1
user::rwx
group::---
other::---

>$ setfacl -m u:user3:rx /home/group1/user1/
>$ getfacl /home/group1/user1
# file: user1/
# owner: user1
# group: group1
user::rwx
user:user3:r-x
group::---
mask::r-x
other::---

>$ ls -l /home/group1
drwxr-x---+ 11 user1 group1 4096 Mar 22 14:57 user1
drwx------   6 user2 group1 4096 Mar 23 12:19 user2

Since I changed the acl's, the group permissions of user1's home directory also changed. Now user2 can read and execute in user1's home directory. The man page for setfacl is a bit sparse.

QUESTION : is there a way to give user3 (who's in group2) permission to user1's home directory without automatically giving user2 permission?

I would like to use acl's for this.

irritable_phd_syndrom

Posted 2016-03-23T20:25:11.393

Reputation: 355

Did you tried to create a new group_N Create a new user UserNew. Do member UserNew user1 and user3 of the group_N. Change the ownership of the home of user1 to UserNew and group_N. Allo._w read write execute to user and group? It should work but I did not suggest you to do for the home. Better to try in a subdir of the home. – Hastur – 2016-03-24T06:09:51.550

Answers

1

Did you really check that user2 can read and execute in user1's home directory?

Hi shouldn't. Everything is done with acl's you set with setfacl.

Oleg Bolden

Posted 2016-03-23T20:25:11.393

Reputation: 1 507

You are correct. user2 cannot read user1's home directory. I guess I was misled by the permissions printed by ls -l. Why does it show the group permissions as being rx? – irritable_phd_syndrom – 2016-03-24T10:35:26.420