![安装具有 minidlna 读/写权限的外部硬盘](https://linux22.com/image/1439023/%E5%AE%89%E8%A3%85%E5%85%B7%E6%9C%89%20minidlna%20%E8%AF%BB%2F%E5%86%99%E6%9D%83%E9%99%90%E7%9A%84%E5%A4%96%E9%83%A8%E7%A1%AC%E7%9B%98.png)
我尝试将我的外部硬盘 (NTFS) 安装在我的树莓派的 /home/pi/dd 上
但是我想拥有对此 HD 上所有文件的读/写权限,因为我想将其一个子文件夹与 minidlna 一起使用:/etc/minidlna.conf 上的示例:
media_dir= /home/pi/dd/a_folder
实际上,挂载后 chown 和 chmod 不起作用......
我所做的事情的例子:
pi@raspberrypi - ~ sudo cat /etc/passwd
pi:x:1000:1000:,,,:/home/pi:/bin/bash
minidlna:x:107:110:MiniDLNA server,,,:/var/lib/minidlna:/usr/sbin/nologin
pi@raspberrypi - ~ sudo cat /etc/fstab
proc /proc proc defaults 0 0
/dev/mmcblk0p5 /boot vfat defaults 0 2
/dev/mmcblk0p6 / ext4 defaults,noatime 0 1
UUID=0A1C40D81C40C105 /home/pi/dd ntfs-3g uid=1000,gid=1000 0 2
pi@raspberrypi - ~ ll
total 12K
drwxr-xr-x 2 pi pi 4,0K janv. 30 10:18 backup_files
drwxr-xr-x 2 pi pi 4,0K janv. 30 10:17 dd
drwxr-xr-x 2 pi pi 4,0K déc. 24 12:34 Desktop
pi@raspberrypi - ~ sudo mount /dev/sda1
pi@raspberrypi - ~ ll
total 24K
drwxr-xr-x 2 pi pi 4,0K janv. 30 10:18 backup_files
drwxrwx--- 1 root 1004 16K janv. 30 07:43 dd
drwxr-xr-x 2 pi pi 4,0K déc. 24 12:34 Desktop
我们可以看到这一行:
drwxrwx--- 1 root 1004 16K janv. 30 07:43 dd
我认为这导致了 minidlna 启动失败:
pi@raspberrypi - ~ sudo service minidlna force-reload
[....] Restarting DLNA/UPnP-AV media server: minidlna[2015/01/30 10:57:31] minidlna.c:474: error: Media directory "/home/pi/dd/Downloads/Music" not accessible! [Permission denied]
[2015/01/30 10:57:31] minidlna.c:474: error: Media directory "/home/pi/dd/Downloads/Films" not accessible! [Permission denied]
. ok
当我 chmod 或 chown dd 文件夹时,文件夹所有者/权限没有任何变化......
我认为我不太了解安装选项......
感谢您的帮助
编辑:这是“sudo cat /proc/mounts”的结果
pi@raspberrypi - ~ sudo cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext4 rw,noatime,data=ordered 0 0
devtmpfs /dev devtmpfs rw,relatime,size=219744k,nr_inodes=54936,mode=755 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=44784k,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /run/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=89560k 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
/dev/mmcblk0p5 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0
/dev/sda1 /home/pi/dd fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0
编辑2:我忘了说我与 samba 共享此文件夹 /home/pi/dd,这是配置文件:
[global]
workgroup = WORKGROUP
server string = %h server
netbios name = Naspi
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[Nas]
path =/home/pi/dd
read only = no
locking = no
guest ok = yes
force user = pi
答案1
问题是你的分区是通过保险丝。这与安装本机文件系统不同。
使用该命令:
sudo mount -t ntfs-3g /dev/sda1 /home/pi/dd -o uid=1000,gid=1000
这应该将分区的用户和组设置为pi
。