繁体   English   中英

有没有办法对将在特定目录下创建的所有文件强制执行权限?

[英]is there a way to force execute permission on all files that will be created under a specific directory?

所以我想知道是否有办法添加一种方法来强制在例如 /tmp/test 目录中创建的所有文件始终具有执行权限?

我通过 setfacl 尝试过,但是那个不允许文件具有执行权限,它允许目录虽然很奇怪......

还有其他想法吗? 我可以尝试做一个 cronjob 或循环的脚本,并在该目录中添加这些权限,但这有点笨拙和粗糙。

默认情况下无法为文件授予执行权限,因为这可能会导致安全问题。

可以使用umask设置其他权限:

 umask [-p] [-S] [mode] The user file-creation mask is set to mode. If mode begins > with a digit, it is interpreted as an octal number; otherwise it is >interpreted as a symbolic mode mask similar to that accepted by chmod(1). If mode is omitted, the >current value of the mask is printed. The -S option causes the mask to be >printed in symbolic form; the default output is an octal number. If the -p option is >supplied, and mode is omitted, the output is in a form that may be reused as >input. The return status is 0 if the mode was successfully changed or if no mode >argument was supplied, and false otherwise.

您将无法访问(更改为)目录,除非它是可执行的。 否则,将出现权限被拒绝的错误。 我不相信在使用 setfacl 创建时可以使每个文件都可执行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM