I am playing with extended file attributes under Linux/Fedora and I am currently stumbling a bit since I cannot add/change attributes for files in /tmp
while in my home it is working fine - while both paths are on the same mount point, i.e.,
/dev/mapper/fedora-root on / type ext4 (rw,relatime,seclabel,data=ordered)
for example, I can successful add and retrieve a attribute for files in my home directory, e.g.,
> setfattr -n user.test.md5 -v 58d8e4cd0e60facf386838cbe8b11767 ~/foo.bar
> getfattr -n user.test.md5 ~/foo.bar
# file: foo.bar
user.test.md5="58d8e4cd0e60facf386838cbe8b11767"
However, the same fails for the same file in /tmp
.
> cp ~/foo.bar /tmp/foo.bar
> setfattr -n user.test.md5 -v 58d8e4cd0e60facf386838cbe8b11767 /tmp/foo.bar
setfattr: /tmp/foo.bar: Operation not supported
I assumed, that the support for extended attributes only depends on the filesystem mounted 'correctly' with xattr support. However, it seems also be directory(??) dependent and I wonder, what prevents me from setting extended attributes in /tmp and how I can change it? (It seems not to be SELinux related - at least I did not find anything in the audit logs.)
/tmp was not as I naively assumed mounted plainly but is mounted as tmpfs, that apparently does not support extended attributes
Thanks to twalberg!