2

I'm trying to use setfattr, but always get Operation not supported

In my home directory, I'm doing the following:

touch delete.me
setfattr -n naomi -v washere delete.me

This returns setfattr: delete.me: Operation not supported.

My home directory is ext4 and delete.me definitely exists. I'm on Fedora 25. Any idea why this is not working?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
pandita
  • 723
  • 2
  • 14
  • 28

1 Answers1

5

You can't just use any name. You need to select a namespace. For arbitrary attribute name, you'd need to use the user namespace:

setfattr -n user.naomi -v washere delete.me

(see man 5 attr for details).

For ext4, the ext_attr feature must be enabled (on by default). Check with:

sudo debugfs -R stats /dev/block/device | grep -w ext_attr

And to be able to use attributes in the user namespace, the filesystem should be mounted with the user_xattr option enabled (also on by default). Check with:

grep user_xattr /proc/self/mountinfo

If it returns nothing, also check the default mount options in the debugfs output above.

Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501