15

Getfattr dumps a listing of extended attributes for a selected file.

However, getfattr --dump filename only to dumps the user.* namespace and not the security.*, system.*, and trusted.* namespaces. Generally, there are no user namespace attributes unless you attached one to a file manually.

Yes I know I can get the SELinux information by using getfattr -n security.selinux filename. In this case, I know the specific identification of the extended attribute.

I have tried this as the root user. I'd assume that the root user with full capabilities is able to access this information. But you only get the user.* namespace dump.

The question is how can I easily get a full dump of all the extended attribute namespaces of a file without knowing the names of all the keys in all the namespaces?

  • and "lsattr" doesn't suffice? (see "man chattr" in order to decode the long attribute string) – Theophrastus Aug 4 '16 at 4:30
11

I hate to do this but the answer is (after more research):

 getfattr -d -m - file

I apparently missed this in my reading of the man page:

-m pattern, --match=pattern

   Only include attributes with names matching the regular expression pattern. [...] Specify "-" for including all attributes.

  • I was using getfattr -d -m '' file for that, I wasn't aware - was a special case, but it looks like it's been like that ever since the feature was added (initially as the -r option). A shame. One needs to use -m '[-]' to search for attributes that contain -. – Stéphane Chazelas Aug 31 '17 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.