24

我找到了一些 Linux 文件,当我输入 时ls -lah,它会输出以下权限格式:

... 
drwxr-xr-x.  2 root    root  
...
-rw-rw-r--.  1 root    root 
...

我想知道,-rw-rw-r--.权限格式末尾的点()是什么意思?

4

4 回答 4

23

info coreutils 'ls invocation'Linux下

GNU `ls' 使用 `.' 表示带有 SELinux 的文件的字符
     安全上下文,但没有其他替代访问方法。

具有任何其他替代访问方法组合的文件是
     标有“+”字符。

于 2015-06-02T11:40:19.667 回答
11

从 GNU.org 列出的信息如下

GNU ls 使用 '.' 字符表示具有 SELinux 安全上下文的文件,但没有其他替代访问方法。

这基本上意味着该文件具有SELinux的访问控制列表 (ACL) 。setfacl您可以使用命令设置或删除文件的 ACL 关联

于 2015-06-02T11:34:33.580 回答
6

根据文件系统权限 wiki 页面,点表示存在 SELinux 上下文。

于 2015-06-02T11:35:41.063 回答
2

所以不是ACL,来自@Tom van der Lee 参考

+ (plus) suffix indicates an access control list that can control additional permissions.
. (dot) suffix indicates an SELinux context is present. Details may be listed with the command ls -Z.
@ suffix indicates extended file attributes are present.

我机器上的一个例子:

$ ls -l 35mm DNS-cache 
-rw-r--r--. 1 graeme graeme     60 Feb 27  2010 35mm
-rw-r--r--  1 graeme everyone 5193 Jun  1 14:45 DNS-cache
$ 
$ getfacl -s 35mm DNS-cache 
$ ls -Z  35mm DNS-cache 
unconfined_u:object_r:user_home_t:s0 35mm
                                   ? DNS-cache

所以getfacl -s没有输出,因为没有 ACL。然而,有一个安全上下文(用ls -Z看到)

于 2021-10-31T16:02:38.997 回答