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

来源:互联网 发布:孚盟软件知乎 编辑:程序博客网 时间:2024/05/18 02:13

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"



原创粉丝点击