权限 – mkdir -p忽略了facl?

前端之家收集整理的这篇文章主要介绍了权限 – mkdir -p忽略了facl?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图在一组特定的目录中强制执行777的文件权限.我使用了“setfacl -m d: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修改)来创建不在树中的任何目录,如果您考虑如何解决已存在的父目录的权限问题,这种情况有何意义?

正如摘录所述,您可以在运行命令之前更改umask,尽管在创建所有内容后在父目录上运行递归chmod可能要容易得多.

原文链接:https://www.f2er.com/centos/373288.html

猜你在找的CentOS相关文章