我有一个目录/read-only-others-group
,其中others
组中的用户应以递归方式对所有文件具有只读访问权限。我尝试了文件模块:
- name: Ensure /read-only-others-group directory exists and gives read-only access to others group
file:
path: /read-only-others-group
state: directory
recurse: yes
owner: someuser
group: somegroup
mode: "0754"
此权限不允许其他组ls
或cat
文件中的用户cd
进入目录或目录下的任何用户。
可以使用如下的shell模块来解决:
find /read-only-others-group -type d -print0 | xargs -0 chmod 755
find /read-only-others-group -type f -print0 | xargs -0 chmod 754
有没有更好的,幂等的解决方案?