Linux常用命令-getfacl

命令

getfacl

描述

get file access control lists
查看文件ACL

用法

1
getfacl [OPTION]... FILE...

选项

1
2
3
4
5
6
7
8
9
10
11
12
13
Options:
-a 只显示文件ACL
-d 只显示默认ACL
-c 不显示起始注释信息
-e 显示所有有效权限effective
-E 不显示有效权限effective
-s 跳过只有基本条目的文件
-R 递归显示子目录
-L 跟随链接跳转
-P 不跟随链接跳转
-t 显示表格格式tab
-n 显示uid和gid
-p 不去除路径前面的/符号

注意

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
$ echo aaa > file
$ chacl u::rw-,g::r--,o::r--,u:usera:rw,m::r file
$ getfacl file
# file: file
# owner: root
# group: root
user::rw-
user:usera:rw- #effective:r--
group::r--
mask::r--
other::r--
$ getfacl -c file
user::rw-
user:usera:rw- #effective:r--
group::r--
mask::r--
other::r--
$ getfacl -e file
# file: file
# owner: root
# group: root
user::rw-
user:usera:rw- #effective:r--
group::r-- #effective:r--
mask::r--
other::r--
$ getfacl -E file
# file: file
# owner: root
# group: root
user::rw-
user:usera:rw-
group::r--
mask::r--
other::r--
$ getfacl -t file
# file: file
USER root rw-
user usera rW-
GROUP root r--
mask r--
other r--
$ getfacl -n file
# file: file
# owner: 0
# group: 0
user::rw-
user:1004:rw- #effective:r--
group::r--
mask::r--
other::r--
$ getfacl /tmp/file
getfacl: Removing leading '/' from absolute path names
# file: tmp/file
...
$ getfacl -p /tmp/file
# file: /tmp/file
...