如何更改已安装磁盘上目录的所有权?

如何更改已安装磁盘上目录的所有权?

磁盘分区/dev/sda7已安装/media/debian/8eda3aeb-e21b-455f-bb7a-f46005fb4893,我想更改目录的所有权/media/debian/8eda3aeb-e21b-455f-bb7a-f46005fb4893/mydoc

sudo chown -R  debian:debian /media/debian/8eda3aeb-e21b-455f-bb7a-f46005fb4893/mydoc

它遇到如下问题:

chown: changing ownership of '/media/debian/8eda3aeb-e21b-455f-bb7a-f46005fb4893/mydoc': Operation not permitted

如何修复它?
显示 uuid 和文件类型:

sudo blkid |grep sda7
/dev/sda7: UUID="B8DC-0104" TYPE="vfat" PARTLABEL="win10" PARTUUID="cdbdb58a-158d-428b-b572-5d4a2ad391c9"

以此方式安装,

cat /etc/fstab
UUID=B8DC-0104    /media/debian/8eda3aeb-e21b-455f-bb7a-f46005fb4893  vfat  rw,user,exec,umask=000 0 0

尝试像@waltinator所说的那样 安装脂肪

步骤1:删除/etc/fstab上的设置,删除以下行

UUID=B8DC-0104    /media/debian/8eda3aeb-e21b-455f-bb7a-f46005fb4893  vfat  rw,user,exec,umask=000 0 0

步骤2:重新启动步骤3:

target=/dev/sda7
mntdir=/mnt/wordpress
sudo mkdir mntdir
sudo mount -t vfat -o remount,rw,user,users,nosuid,nodev,relatime,uid=$(id -u),gid=$(id -g),fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2 $target $mntdir

错误信息:

mount: /mnt/wordpress not mounted or bad option

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

显示消息

sudo dmesg|tail
[   39.748493] ashmem: initialized
[   46.748313] NET: Registered protocol family 3
[   46.958169] NET: Registered protocol family 5
[   48.384024] audit: type=1400 audit(1596700794.077:36): apparmor="STATUS" operation="profile_load" profile="unconfined" name="docker-default" pid=1476 comm="apparmor_parser"
[   50.467394] audit: type=1326 audit(1596700796.161:37): auid=4294967295 uid=0 gid=0 ses=4294967295 subj==unconfined pid=780 comm="anbox" exe="/snap/anbox/186/usr/bin/anbox" sig=0 arch=c000003e syscall=165 compat=0 ip=0x7fab12334c5a code=0x7ffc0000
[   50.769984] audit: type=1326 audit(1596700796.461:38): auid=4294967295 uid=0 gid=0 ses=4294967295 subj==unconfined pid=780 comm="anbox" exe="/snap/anbox/186/usr/bin/anbox" sig=0 arch=c000003e syscall=165 compat=0 ip=0x7fab12334c5a code=0x7ffc0000
[   51.179790] audit: type=1326 audit(1596700796.873:39): auid=4294967295 uid=0 gid=0 ses=4294967295 subj==unconfined pid=780 comm="anbox" exe="/snap/anbox/186/usr/bin/anbox" sig=0 arch=c000003e syscall=165 compat=0 ip=0x7fab12334c5a code=0x7ffc0000
[   54.041691] Bridge firewalling registered
[   54.212587] Initializing XFRM netlink socket
[   54.368677] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready

答案1

由于sudo不起作用,请运行su,输入 root 密码,然后运行chown -R debian:debian /media/debian/8eda3aeb-e21b-455f-bb7a-f46005fb4893/mydoc​​。应该工作。

相关内容