我正在使用 raspberry 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
位于:/media/USBHDD1/shares
现在我试图给它所有的写读和执行权限,甚至将所有者和组更改为 pi:pi
但是,chmod 777
不工作——它没有返回错误,只是似乎没有效果
当我使用
sudo chown -R pi:pi test/
我得到了错误
chown: changing ownership of `test/': Operation not permitted
这是一个 linux 问题,但我认为具有使用 raspberry pi 的背景和知识的人可以帮助我。
要求的额外信息:
当我运行 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
原因是因为所有权和权限是在挂载时为 vfat
定义的财政司司长。
Manual page mount(8):
Mount options for fat ..
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.
您至少可以做三件事:
(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
通过更改 umask
和 dmask
(不推荐):
mount -o remount,umask=000,dmask=000 /media/USBHDD1
(3) 将分区更改为不同的文件系统。仅当您不是从 Windows 计算机访问外部硬盘驱动器时才执行此操作:
您无法将文件系统从 VFAT 转换为 Unix 兼容的 FS,因此您必须备份驱动器的内容,格式化为 EXT3+ 或 reiserfs,然后将内容复制回来。 您可以在网上找到执行此操作的教程。