# get target directory path (this will change through each iteration of the utility) $destination = "/abc/def/ghi/jkl" # this is a directory `sudo -u UserB setfacl ....set group level perms on $destination` # is target direcory readable now -r $destination or $newdestination = traverse backwards to next level (e.g. "/abc/def/ghi") run the sudo command to set the perms on $newdestination Do the read test again on the original $destination If successful finish otherwise traverse back up the directory chain again and redo the setfacl and read test