- 论坛徽章:
- 0
|
本帖最后由 wwenyunkui2013 于 2014-12-03 16:14 编辑
[root@test_client test]# id test2
uid=502(test2) gid=502(test2) groups=502(test2),504(test)
protocols文件的原本属性:
[root@test_client test]# ll protocols
-rw-------. 1 root root 6455 Nov 25 10:49 protocols
[root@test_client test]# getfacl protocols
# file: protocols
# owner: root
# group: root
user::rw-
group::---
other::---
test2不能读取该文件:
[root@test_client test]# su - test2
[test2@test_client ~]$ vi /tmp/test/protocols
[test2@test_client ~]$ cat /tmp/test/protocols
cat: /tmp/test/protocols: Permission denied
[test2@test_client ~]$ exit
logout
修改文件的ACL:
[root@test_client test]# setfacl -m u:test2:rw protocols
[root@test_client test]# getfacl protocols
# file: protocols
# owner: root
# group: root
user::rw-
user:test2:rw-
group::---
mask::rw-
other::---
test2能够成功读取:
[root@test_client test]# su - test2
[test2@test_client ~]$ cat /tmp/test/protocols
# /etc/protocols:
# $Id: protocols,v 1.9 2009/09/29 15:11:55 ovasik Exp $
#
.
.
.
.
恢复文件的ACL:
[root@test_client test]# setfacl -b protocols
[root@test_client test]# getfacl protocols
# file: protocols
# owner: root
# group: root
user::rw-
group::---
other::---
|
|