0

I'm trying to make new files and directories within a directory always have the same permissions and group.

I've done this:

cd /
sudo mkdir apps
sudo chown deploy:www-data apps
sudo chmod g+s apps
sudo setfacl -d -m g:www-data:rwx apps/
cd apps
mkdir foo
ls -lah foo

I get the correct permissions and group ownership for foo:

drwxrwsr-x+  2 deploy www-data 4.0K Apr 22 17:29 foo

However, if I do this:

mkdir -p /apps/bar

... I get the correct group ownership, but not the group permissions:

drwxr-sr-x+  2 deploy www-data 4.0K Apr 22 17:30 bar

There is clearly something I do not understand in the way ACLs work. I can't find why the second directory does not have rwx group permissions.

0

The mkdir -p will use the default umask. You can combine it with -m to set the permissions

mkdir -m 2775 -p path/dirname
1
  • Yes, that is what I noticed. How can I make mkdir respect the ACLs ?
    – agregoire
    Apr 25 '16 at 12:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.