mkdir -p忽略facl?

我试图强制执行一个特定的一套dir的777文件权限。 我使用“setfacl -md:o :: rwx”,并得到什么似乎是正确的权限

$ getfacl . # file: . # owner: blah # group: blah # flags: -s- user::rwx group::rwx other::rwx default:user::rwx default:group::rwx default:other::rwx 

当我运行mkdir时,我得到一个带有正确的烫发的目录。

 $ mkdir test $ ll -d test drwxrwsrwx+ 2 blah blah 4096 Oct 28 10:26 test 

当我运行“mkdir -p”时,我得到与umask相匹配的perms,而不是acl。

 $ mkdir -p test1 $ ll -d test1 drwxrwsr-x+ 2 blah blah 4096 Oct 28 10:27 test1 

有什么我失踪?

我相信这是正确的行为。 看信息mkdir:

 `-p' `--parents' Make any missing parent directories for each argument, setting their file permission bits to the umask modified by `u+wx'. Ignore existing parent directories, and do not change their file permission bits. To set the file permission bits of any newly-created parent directories to a value that includes `u+wx', you can set the umask before invoking `mkdir'. For example, if the shell command `(umask u=rwx,go=rx; mkdir -p P/Q)' creates the parent `P' it sets the parent's permission bits to `u=rwx,go=rx'. To set a parent's special mode bits as well, you can invoke `chmod' after `mkdir'. *Note Directory Setuid and Setgid::, for how the set-user-ID and set-group-ID bits of newly-created parent directories are inherited. 

因此,mkdir -p将采用umask值(由u+rw修改)来创build不在树中的任何目录,如果考虑如何解决已存在的父目录的权限问题,那么这种方法是否合理?

如摘录所示,可以在运行该命令之前更改umask,但在创build完所有内容后,可能会更容易在父目录上运行recursionchmod。