Having the following directory structure

[sr@server directory]$ tree
├── folder1
│   ├── fileA
│   └── fileB
└── folder2
    └── fileC

2 directories, 3 files

I want to set a default facl on folder1 and folder2 that, for the user jim has the following permissions

├── folder1      --x
│   ├── fileA    r--
│   └── fileB    r--
└── folder2      --x
    └── fileC    r--

I.E. all files have r-- and all folders have --x

Any files created under folder1 or folder2 should be given the r-- permission for user jim, any folders should be given the --x permission for user jim

I can set the permissions so folders created have r-x and files have r-- but I can't figure out a way to set the default permissions so folders don't get the read permission.

While I can manually set the permissions for the currently existing files I want those permissions to apply as defaults to all newly created files and folders.

setfacl version 2.2.49 on RHEL 6.4


What you request is not supported by Linux's ACLs.

setfacl -m u:jim:r-X (capital X) gives Jim permission to read all files including directories, and to execute only directories and files that are executable by their owner.

Making directories non-readable has very limited usefulness. If you tell us what you're trying to accomplish, we might be able to offer a better solution.

  • I have a directory that another user needs to access specific files from, however I don't want to give them execute permissions on the directory to prevent them from listing the contents. Default ACLs seemed like the best way to go about achieving this – Smudge Mar 14 '14 at 2:42
  • 1
    @sam I can't think of a simpler solution that adapting your directory creation script to call setfacl. You could do that with an incron rule if it absolutely needs to be automatic. – Gilles Mar 14 '14 at 9:28
  • not perfect, but it'll work. Thanks – Smudge Mar 14 '14 at 18:03

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.