“ls -lah”命令输出中权限末尾的点号是什么意思?

36

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

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

我想了解,权限格式结尾处的点号 (-rw-rw-r--.) 代表什么意思?


ACL - 请参阅http://superuser.com/questions/230559/what-does-the-dot-mean-at-the-end-of-rw-r-r-how-do-you-set-it-with-chmod - doctorlove
4个回答

32
从 Linux 下的 info coreutils 'ls invocation' | grep -1 '[.+]. character' 处:
GNU `ls' 使用 `.' 字符来表示具有 SELinux 安全上下文但没有其他交替访问方法的文件。
具有任何其他组合的交替访问方法的文件将标记为 `+' 字符。

如果点号是文件权限中的第一个字符而不是最后一个字符,那该怎么办? - VimNing

14

根据GNU.org在列出了哪些信息一文中的描述:

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

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


13
因此,来自@Tom van der Lee参考的内容不是ACL。
+ (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看到)。


7

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接