ach*_*lle 2 usb permissions chown
我有一个 USB 盘,上面有一些目录。所有文件都属于根目录。
\nwhoami \nroot \n\nid\nuid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023\n\n\nlsblk -f \n[...]\n \xe2\x94\x9c\xe2\x94\x80cs-root xfs 8cd99025-279f-4bc5-82c2-914200ae4e1a /\n \xe2\x94\x9c\xe2\x94\x80cs-swap swap af0674c2-a5e9-4646-be91-93c6f876eb88 [SWAP]\n \xe2\x94\x94\xe2\x94\x80cs-home xfs 39212c8d-0a88-4e55-91c9-a5751233a5ca /home\nsdb \n\xe2\x94\x94\xe2\x94\x80sdb1 vfat 36C7-16EE #-> the faulty usb device, vfat formated.\n\nls -ld /mnt\ndrwxr-xr-x. 10 root root 32768 Dec 31 1969 /mnt\n
Run Code Online (Sandbox Code Playgroud)\n我尝试将所有文件的所有权更改为普通用户 (achille)\n但由于意外错误消息,该命令失败
\nchown achille: -R /mnt\n\n...\nchown: changing ownership of '/mnt/2.order/virtualbox/install.VirtualBox.Centos': Operation not permitted\nchown: changing ownership of '/mnt/2.order/virtualbox/install.virtualbox.local.repos': Operation not permitted\nchown: changing ownership of '/mnt/2.order/virtualbox/warning/install.AdditionsGuest': Operation not permitted\nchown: changing ownership of '/mnt/2.order/virtualbox/warning/install.virtualbox.local.repos': Operation not permitted\nchown: changing ownership of '/mnt/2.order/virtualbox/warning/readme.txt': Operation not permitted\nchown: changing ownership of '/mnt/2.order/virtualbox/warning': Operation not permitted\nchown: changing ownership of '/mnt/2.order/virtualbox/Centos8.ova': Operation not permitted\nchown: changing ownership of '/mnt/2.order/virtualbox/vbox.forum.infos.txt': Operation not permitted\nchown: changing ownership of '/mnt/2.order/virtualbox/vbox.post': Operation not permitted\nchown: changing ownership of '/mnt/2.order/virtualbox': Operation not permitted\nchown: changing ownership of '/mnt/2.order/openssl.en-de_cryption': Operation not permitted\nchown: changing ownership of '/mnt/2.order': Operation not permitted\nchown: changing ownership of '/mnt/vim.config.files.paths': Operation not permitted\nchown: changing ownership of '/mnt': Operation not permitted\n
Run Code Online (Sandbox Code Playgroud)\n我尝试:
\nchown achille: /mnt\nchown: changing ownership of '/mnt': Operation not permitted\n
Run Code Online (Sandbox Code Playgroud)\n我检查了 sysctl 配置,但看不到任何可能与此问题相关的内容:
\nfs.protected_fifos = 0\nfs.protected_hardlinks = 1\nfs.protected_regular = 0\nfs.protected_symlinks = 1\n
Run Code Online (Sandbox Code Playgroud)\nUSB 上没有机械锁,但 USB 已满:
\ndf -h /mnt\nFilesystem Size Used Avail Use% Mounted on\n/dev/sdb1 7.4G 7.4G 384K 100% /mnt\n
Run Code Online (Sandbox Code Playgroud)\n问题:出现这种错误的原因可能是什么?难道是因为vfat fs的原因?
\n谢谢大家!!
\n您vfat
不能拥有所有者和组,因为它在其他文件系统中可用。因此,最好的方法(如果您想向普通用户提供权限)是卸载 USB 驱动器,更改权限和所有权/mnt
,然后使用特定选项进行安装:
mount -o uid=achille,other_options /dev/sdb1 /mnt
Run Code Online (Sandbox Code Playgroud)
(不确定uid
选项是否适用于vfat
)