我使用ansible修改其他配置文件时都可以修改,在修改/etc/shadow文件时会报错:
setfacl: /etc/shadow: Operation not permittednon-zero return code
setfacl: /etc/shadow: Operation not permitted
请问怎样才能使用ansible来修改/etc/shadow文件的acl权限呢?
我使用shell模块 ansible test1 -m shell -a 'setfacl -m user:aiuap:r /etc/shadow'
如下报错
10.124.210.222 | FAILED | rc=1 >>
setfacl: /etc/shadow: Operation not permittednon-zero return code
我使用acl模块 ansible test1-m acl -a 'path=/etc/shadow entity=test etype=user permissions=r state=present'
如下报错
10.124.210.222 | FAILED! => {
"changed": false,
"cmd": "/usr/bin/setfacl -m user:test:r /etc/shadow",
"msg": "setfacl: /etc/shadow: Operation not permitted",
"rc": 1,
"stderr": "setfacl: /etc/shadow: Operation not permitted\n",
"stderr_lines": [
"setfacl: /etc/shadow: Operation not permitted"
],
"stdout": "",
"stdout_lines": []
}
我使用script模块 ansible test1 -m script -a './acl.sh'
提示成功,但是实际上并未修改/etc/shadow的文件acl权限.
10.124.210.222 | SUCCESS => {
"changed": true,
"rc": 0,
"stderr": "Shared connection to 10.124.210.222 closed.\r\n",
"stderr_lines": [
"Shared connection to 10.124.210.222 closed."
],
"stdout": "setfacl: /etc/shadow: Operation not permitted\r\ngetfacl: Removing leading '/' from absolute path
namesrn# file: etc/shadowrn# owner: rootrn# group: rootrnuser::---rngroup::---rnother::---rnrn", "stdout_lines": [
"setfacl: /etc/shadow: Operation not permitted",
"getfacl: Removing leading '/' from absolute path names",
"# file: etc/shadow",
"# owner: root",
"# group: root",
"user::---",
"group::---",
"other::---",
""
]
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。