setfacl default --x on directories and r-- on files for user
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.
Related videos on Youtube
Smudge
Software engineer, platform architect, server harassing, coffee drinking, photo taking, music listening dog thing.
Updated on September 18, 2022Comments
-
Smudge over 1 year
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 userjim
, any folders should be given the--x
permission for userjim
I can set the permissions so folders created have
r-x
and files haver--
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 -
Smudge about 10 yearsI 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
-
Gilles 'SO- stop being evil' about 10 years@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. -
Smudge about 10 yearsnot perfect, but it'll work. Thanks