2

I did the following and I don't understand the end result:

$ mkdir mydir
$ setfacl -d -m u::rwX,g::rwX,o::rX,m::rwx mydir
$ touch mydir/test.txt
$ getfacl mydir/test.txt
# file: mydir/test.txt
# owner: ubuntu
# group: ubuntu
user::rw-
group::rwx          #effective:rw-
mask::rw-
other::r--

$ setfacl -m g::rwX mydir/test.txt
$ getfacl mydir/test.txt
# file: mydir/test.txt
# owner: ubuntu
# group: ubuntu
user::rw-
group::rwx
mask::rwx
other::r--

So, here's what I expect to be happening:

  1. make directory and set defaults for newly created files within that directory (the 'X' is executable if a directory or only executable for a regular file if already executable)
  2. touch makes a new file with 'rw-rw-r--' permissions and a 'rwx' mask
  3. setfacl -m g::rwX mydir/test.txt should do nothing as the file should already have group 'rw-' with a mask of 'rwx'

What is actually happening is:

  1. directory is created by the reported defaults are:
    default:user::rwx
    default:group::rwx
    default:mask::rwx
    default:other::r-x
  1. touch makes a file that shows 'rw-rw-r--' in ls but getfacl shows that the group permission is actually 'rwx' and is just masked to be 'rw-' because the mask is 'rw-' instead of the default 'rwx'
  2. since test.txt is already group 'rwx' then setfacl -m g::rwX mydir/test.txt doesn't change the group permission, but does cause the mask to be recalculated to 'rwx' which makes the 'x' permission on the group show through in ls now.

Why is the default mask on the directory not applied to the new file? Why does the new file's group permission include an execute bit?

Here's the getfacl on the mydir:

# file: mydir
# owner: ubuntu
# group: ubuntu
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:mask::rwx
default:other::r-x

Why does getfacl not include 'X' (capitalized) and only show 'x' in the default settings?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.