root 无法 chown /mnt 目录

root 无法 chown /mnt 目录

我有一个 USB 密钥,上面有一些目录。所有文件都属于 root。

whoami 
root 

id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023


lsblk -f 
[...]
  ├─cs-root xfs               8cd99025-279f-4bc5-82c2-914200ae4e1a   /
  ├─cs-swap swap              af0674c2-a5e9-4646-be91-93c6f876eb88   [SWAP]
  └─cs-home xfs               39212c8d-0a88-4e55-91c9-a5751233a5ca   /home
sdb                                                                  
└─sdb1      vfat              36C7-16EE    #-> the faulty usb device, vfat formated.

ls -ld /mnt
drwxr-xr-x. 10 root root 32768 Dec 31  1969 /mnt

我尝试将所有文​​件的所有权更改为普通用户(achille),但由于出现意外错误消息,命令失败

chown achille: -R /mnt

...
chown: changing ownership of '/mnt/2.order/virtualbox/install.VirtualBox.Centos': Operation not permitted
chown: changing ownership of '/mnt/2.order/virtualbox/install.virtualbox.local.repos': Operation not permitted
chown: changing ownership of '/mnt/2.order/virtualbox/warning/install.AdditionsGuest': Operation not permitted
chown: changing ownership of '/mnt/2.order/virtualbox/warning/install.virtualbox.local.repos': Operation not permitted
chown: changing ownership of '/mnt/2.order/virtualbox/warning/readme.txt': Operation not permitted
chown: changing ownership of '/mnt/2.order/virtualbox/warning': Operation not permitted
chown: changing ownership of '/mnt/2.order/virtualbox/Centos8.ova': Operation not permitted
chown: changing ownership of '/mnt/2.order/virtualbox/vbox.forum.infos.txt': Operation not permitted
chown: changing ownership of '/mnt/2.order/virtualbox/vbox.post': Operation not permitted
chown: changing ownership of '/mnt/2.order/virtualbox': Operation not permitted
chown: changing ownership of '/mnt/2.order/openssl.en-de_cryption': Operation not permitted
chown: changing ownership of '/mnt/2.order': Operation not permitted
chown: changing ownership of '/mnt/vim.config.files.paths': Operation not permitted
chown: changing ownership of '/mnt': Operation not permitted

我尝试:

chown achille: /mnt
chown: changing ownership of '/mnt': Operation not permitted

我检查了 sysctl 配置,但找不到与此问题相关的任何内容:

fs.protected_fifos = 0
fs.protected_hardlinks = 1
fs.protected_regular = 0
fs.protected_symlinks = 1

USB上没有机械锁,但是USB已满:

df -h /mnt
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       7.4G  7.4G  384K 100% /mnt

问题:这种错误可能是什么原因造成的?可能是因为 vfat fs 吗?

谢谢大家!!

答案1

vfat无法拥有所有者和组,因为它在其他文件系统中可用。因此,好的方法是(如果您想向普通用户提供权限)卸载 USB 驱动器,更改权限和所有权/mnt,然后使用特定选项进行安装:

mount -o uid=achille,other_options /dev/sdb1 /mnt

(不确定uid该选项是否可以很好地配合使用vfat

答案2

vfat文件系统不支持 Unix 所有权,这就是Operation not permitted错误消息告诉您的内容。

相关内容