chown命令返回不允许操作

l00*_*ake 10 linux usb-drive fat chown raspberry-pi

我正在使用覆盆子pi,并且很难使用以下教程为我安装的外部硬盘驱动器授予权限:

http://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/

我现在已经在该外部硬盘驱动器上创建了文件夹,当我执行ls -l命令时,我返回以下内容:

drwxr-xr-x 2 root root 512 Aug 28 23:24 test
Run Code Online (Sandbox Code Playgroud)

它位于: /media/USBHDD1/shares

现在我试图给它所有写入读取和执行权限,甚至将所有者和组更改为pi:pi

但是,chmod 777不起作用 - 它不会返回错误,只是似乎没有效果

当我使用时

sudo chown -R pi:pi test/
Run Code Online (Sandbox Code Playgroud)

我收到了错误

chown: changing ownership of `test/': Operation not permitted
Run Code Online (Sandbox Code Playgroud)

这是一个linux问题,但我认为有背景和使用树莓派知识的人可以帮助我.

所需的额外信息:

当我运行pi@raspberrypi /media $ grep USBHDD1 /etc/mtab 它时返回:

/dev/sda1 /media/USBHDD1 vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0
Run Code Online (Sandbox Code Playgroud)

mst*_*ias 14

原因是因为所有权和权限是在vfatFS的安装时定义的.

手动页面安装(8):

装载脂肪的选择..

   uid=value and gid=value

          Set the owner and group of all files.  (Default: the uid and gid
          of the current process.)

   umask=value

          Set the umask (the bitmask  of  the  permissions  that  are  not
          present).  The default is the umask of the current process.  The
          value is given in octal.
Run Code Online (Sandbox Code Playgroud)

你至少可以做三件事:

(1)pi:pi访问整个/ media/USBHDD1安装座:

mount -o remount,gid=<pi's gid>,uid=<pi's uid> /media/USBHDD1

确定pi的uid:

cat /etc/passwd |grep pi

确定pi的gid:

cat /etc/group |grep pi

(2)/media/USBHDD1通过更改umaskdmask(不推荐)给每个人访问:

mount -o remount,umask=000,dmask=000 /media/USBHDD1

(3)将分区更改为其他文件系统.只有在您不从Windows计算机访问外部硬盘驱动器时才执行此操作:

您将无法将文件系统从VFAT转换为与Unix兼容的FS,因此您必须备份驱动器的内容,格式为EXT3 +或reiserfs,然后将内容复制回来. 您可以在网上找到这样做的教程.