红联Linux门户
Linux帮助

Linux文件权限属性后面的点的含义(ls -l)

发布时间:2015-11-03 15:42:04来源:linux网站作者:xinlongabc

今天突然注意到$ls -l显示文件时,权限列后面有个点。
如:

-rw-rw-r--.  1 user group    13767 10月 25 2015 index.html


解释:
开启了SELinux功能的Linux系统才会有这个点。
那个点表示文件带有“SELinux的安全上下文”。
CentOS7默认是开启SELinux的,所以会有这个点,
如果关闭SELinux,然后再创建文件,新创建的文件就不会再有这个点了,
但是以前创建的文件本来有这个点的还会显示这个点(虽然SELinux不起作用了)。


参考下边命令应该能得到答案

$info coreutils 'ls invocation'
Following the file mode bits is a single character that specifies
whether an alternate access method such as an access control list
applies to the file. When the character following the file mode
bits is a space, there is no alternate access method. When it is
a printing character, then there is such a method.
在文件权限位后面,附加有一个单字符。用来表示是否有一个
可替换的访问控制措施应用在这个文件上。例如,访问控制列表(ACL,access control list)。
当文件权限位后面附加的是一个空格时,表示系统没有可替换的访问控制措施。
当是一个可打印字符时,表示系统存在这样一个访问控制措施。

GNU ‘ls’ uses a ‘.’ character to indicate a file with an SELinux
security context, but no other alternate access method.
GNU的ls命令使用 ‘.’字符表示文件使用了SELinux安全上下文,
但是没有使用其他的访问控制措施。

A file with any other combination of alternate access methods is
marked with a ‘+’ character.
一个文件结合了其他访问控制措施,文件用‘+’字符标记 。(如:ACL)

一个文件就算没有SELinux上下文,只用应用ACL,也能标记成‘+’字符。
一个文件有SELinux上下文,也有ACL,也标记成‘+’字符。


例如:

# ll -Z
-rw-r--r--  root root ?                                a.file  #没有SElinux上下文,没有ACL
-rw-r--r--+ root root ?                                b.file  #只有ACL,没有SElinux上下文
-rw-------. root root system_u:object_r:admin_home_t:s0 my.cnf #只有SElinux上下文,没有ACL
-rw-rw-r--+ root root unconfined_u:object_r:user_tmp_t:s0 dd.c #有SElinux上下文,有ACL


ls -l列表信息详解:http://www.linuxdiyf.com/linux/2038.html

Linux常用命令ll 即ls -l --color=auto:http://www.linuxdiyf.com/linux/8180.html