【发布时间】:2015-06-10 15:01:47
【问题描述】:
我正在使用 Linux/Fedora 下的扩展文件属性,我目前有点磕磕绊绊,因为我无法在 /tmp 中添加/更改文件的属性,而在我的家中它工作正常 - 虽然两条路径都在相同挂载点,即
/dev/mapper/fedora-root on / type ext4 (rw,relatime,seclabel,data=ordered)
例如,我可以成功地为我的主目录中的文件添加和检索属性,例如,
> setfattr -n user.test.md5 -v 58d8e4cd0e60facf386838cbe8b11767 ~/foo.bar
> getfattr -n user.test.md5 ~/foo.bar
# file: foo.bar
user.test.md5="58d8e4cd0e60facf386838cbe8b11767"
但是,/tmp 中的同一文件同样失败。
> cp ~/foo.bar /tmp/foo.bar
> setfattr -n user.test.md5 -v 58d8e4cd0e60facf386838cbe8b11767 /tmp/foo.bar
setfattr: /tmp/foo.bar: Operation not supported
我假设,对扩展属性的支持仅取决于使用 xattr 支持“正确”安装的文件系统。但是,它似乎也依赖于目录(??),我想知道,是什么阻止我在 /tmp 中设置扩展属性以及如何更改它? (似乎与 SELinux 无关——至少我在审计日志中没有发现任何内容。)
【问题讨论】:
-
您确定
/home和/tmp都是/的一部分吗?它们通常不...尤其是/tmp可能是tmpfs文件系统,它可能不支持您感兴趣的扩展属性... -
@twalberg 你是对的!我天真地没有正确检查 /tmp 是如何实际安装的,但是从我的初始设置 tmpfs on /tmp type tmpfs (rw,seclabel)
标签: linux file-attributes xattr tmpfs