`chattr +x` 是用来做什么的?

`chattr +x` 是用来做什么的?

联机chattr(1)帮助页将该属性描述x为:

x      The  'x' attribute can be set on a directory or file.  If the attri‐
       bute is set on an existing directory, it will be  inherited  by  all
       files and subdirectories that are subsequently created in the direc‐
       tory.  If an existing directory has contained some files and  subdi‐
       rectories,  modifying  the attribute on the parent directory doesn't
       change the attributes on these files and subdirectories.

所以这个属性被新创建的文件/子目录继承,但除此之外,手册页没有指定任何效果。这个属性有什么用呢?

答案1

看起来 Ubuntu Jammy 附带的 e2fsprogs 版本缺少手册页中的一些信息最新版本:

 x      A file with the 'x' requests the use of direct access
        (dax) mode, if the kernel supports DAX.  This can be
        overridden by the 'dax=never' mount option.  For more
        information see the kernel documentation for dax:
        <https://www.kernel.org/doc/html/latest/filesystems/dax.html>.

        If the attribute is set on an existing directory, it will
        be inherited by all files and subdirectories that are
        subsequently created in the directory.  If an existing
        directory has contained some files and subdirectories,
        modifying the attribute on the parent directory doesn't
        change the attributes on these files and subdirectories.

这是添加在这次提交,发布于 1.46.6,即 Ubuntu 软件包之后的版本。

相关内容