1. 程式人生 > >linux下setfattr命令出錯:setfattr: file0: Operation not supported

linux下setfattr命令出錯:setfattr: file0: Operation not supported

1.執行命令時出錯:

執行環境為linux,檔案所在的檔案系統為ext4(可通過mount命令檢視)

#setfattr -n test-xattr -v "test" file0

setfattr: file0: Operation not supported (提示資訊)

2.檢視man setfattr和man 5 attr

其中的man 5 attr部分內容為:

。。。。。。。。。。。

EXTENDED ATTRIBUTE NAMESPACES
       Attribute  names  are  zero-terminated  strings.   The  attribute  name is always specified in the fully qualified namespace.attribute form, eg.
       user.mime_type, trusted.md5sum, system.posix_acl_access, or security.selinux.

       The namespace mechanism is used to define different classes of extended attributes.  These different classes exist for several reasons, e.g. the
       permissions and capabilities required for manipulating extended attributes of one namespace may differ to another.

       Currently  the security, system, trusted, and user extended attribute classes are defined as described below. Additional classes may be added in
       the future.

。。。。。。。。。。。。。

所以可以知道setfattr -n指定的擴充套件屬性名字要符合一定的要求。

3.按上面的名字要求再次執行命令

#setfattr -n trusted.test-attr -v "test" file0

(可以執行成功了,大笑

並且可以通過命令檢視

#getfattr -d -m "" file0

輸出結果如下:

# file: file0
trusted.test-xattr="test"