`-rw-r--r--`末尾的点是什么意思?你如何用`chmod`设置它?

Dar*_*ane 123 linux shell permissions selinux

我在 Linux 下的目录中的一些文件在.权限列表的末尾有一个。

  • 结尾的点是什么意思-rw-r--r--
  • 你如何设置它chmod

Chr*_*ung 120

根据ls.c(第 3785 行),.表示SELinux ACL。(+表示通用 ACL。)


小智 46

我有同样的问题。我花了一段时间才找到这个,浏览了“man ls”页面一百次(好吧,也许不是那么频繁),直到我终于看到了 SEE ALSO 部分中关于使用命令的注释:

 info coreutils 'ls invocation'
Run Code Online (Sandbox Code Playgroud)

在描述“-l”(--format=long)的部分中:

 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.

 GNU `ls' uses a `.' character to indicate a file with an SELinux
 security context, but no other alternate access method.

 A file with any other combination of alternate access methods is
 marked with a `+' character.
Run Code Online (Sandbox Code Playgroud)


小智 14

这是 SELinux 上下文。尝试ls -Z /your/file

引用我的 man ls

   SELinux options:

   --lcontext
          Display security context.   Enable -l. Lines will probably be too wide for most displays.

   -Z, --context
          Display security context so it fits on most displays.  Displays only mode, user, group, security context and file name.

   --scontext
          Display only security context and file name.
Run Code Online (Sandbox Code Playgroud)

要改变这种情况,请尝试以下命令之一:chconsemanage fcontextrestorecon

这里解释得很清楚:https : //access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-SELinux_Contexts_Labeling_Files.html


小智 11

这意味着该文件具有 SELinux 的访问列表。查看此主题,它告诉您如何允许您编辑/更改文件http://ubuntuforums.org/showthread.php?t=1315684


Sie*_*geX 2

这很可能是由于访问控制列表(ACL)造成的,尽管我只看到它们显示+rw-rw-rw-+. 也许这.意味着该文件缺少 ACL。

您可以尝试getfacl .在当前目录中键入内容以查看这些文件可能具有哪些访问控制。

  • 不,这个点并不意味着缺少 ACL - 请参阅其他答案 (4认同)