ACL for users not working correctly [Debian]

0

I wrote a script that creates some users (5 in this case) called 1 to 5, creates their home directories, and gives full access to those directories only to those five users. Here is the script:

MIN=1
MAX=5
for (( USER=$MIN; USER<=$MAX; USER++ )); do
    useradd -m $USER
    HOMEDIR=/home/$USER
    setfacl -m o:--- $HOMEDIR
    for (( other=$MIN; other<=$MAX; other++ )); do
        setfacl -m u:$other:x $HOMEDIR
    done
done

This script is executed as a root, and after that I do

su - 1
cd /home/2

And the result is

bash: cd: 2: Permission denied

I executed this script on Ubuntu 17.04 and Debian 8.9 with ACL turned on by default, and on both platforms I get the same result. What could be the problem?

Troubled

Posted 2017-10-10T16:28:44.880

Reputation: 1

Care to update your question with the output of getfacl /home/2 Otherwise your question is missing a crucial information. – kostix – 2017-10-10T17:25:08.683

Also note that granting x w/o also granting r is possible but almost useless: x allows cd-ing into the directory and searching in and through it, but only r actually allows reading the directory contents. Hence with only x allowed, you could not even do ls. – kostix – 2017-10-10T17:26:42.120

No answers