I know there are plenty of questions and answers about ACL and permissions, but to be honest they are so weak to make any coherent understanding! it's just like a mix of unorganized information.
Hope this question will put an end to this confusion
Problem:
On my Ubuntu 14.04 web server, I want to:
- make all
files/future_files
with640
permissions, - all
folders/future_folders
with750
permissions, - AND make
Admin:www-data
the only default owners
My solution:
I used ACLs:
setfacl -Rdm u:admin:rwX /path/to/parent //capital X apply for folders
setfacl -Rdm g:www-data:rX /path/to/parent
setfacl -Rdm o::- /path/to/parent
now already existed files and folders take the rules perfectly.
Issue:
Now I am logged as user admin
, when I make new directory it gets 770
not 750
? And when I make new file it gets 660 not 640? Why isn't it adopting the rules!?
Here is getfacl
output:
# owner: admin
# group: www-data
# flags: ss-
user::rwx
group::r-x
other::---
default:user::rwx
default:user:admin:rwx
default:group::r-x
default:group:www-data:r-x
default:mask::rwx
default:other::---
It looks like there is some conflict between rules! although I deleted all ACL before applying the new rules.
P.S. I remember combining them in one command like below used to work... but it's not!
etfacl -Rdm u:admin:rwX,g:www-data:rwX,o::- /path/to/parent
If you know a correct short version please don't hesitate to provide :)
umask
for the useradmin
, it is having a default permission of0022
. You can change it as per your requirement. – AReddy Mar 01 '16 at 13:24