文件/文件夹权限和 plex

文件/文件夹权限和 plex

我有一个运行 Kubuntu 的英特尔 NUC(基于 Ubuntu 18.04.3 LTS \n \l)和 Plex 服务器,无头。我使用了各种指导来进行设置。计算机的普通用户帐户是“exharris”,计算机名称是“nucserv”。

Plex 媒体文件全部包含在旧的外部设备上NTFSUSB HDD 2TB 通过 USB 连接到 NUC。因为是NTFS,所以我下载的是NTFS-3g。

我已将此驱动器安装到/media/ntfs。我注意到在终端中, ls 显示“root”拥有的所有文件(不确定这个事实有多相关)

exharris@nucserv:/media/ntfs$ ls -l
total 92
drwxr-xr-x 1 root root  4096 Sep 14 16:22  Drivers
drwxr-xr-x 1 root root     0 Sep 14 16:35  EBooks
drwxr-xr-x 1 root root  4096 Sep 14 16:39  iTunes
drwxr-xr-x 1 root root  4096 Sep 14 16:41 'July 19 downloads'
drwxr-xr-x 1 root root  4096 Sep 14 16:41 'Mindfulness Skills Vol 1'
drwxr-xr-x 1 root root  4096 Sep 14 16:41  Misc
drwxr-xr-x 1 root root 40960 Sep 28 12:27  Movies
drwxr-xr-x 1 root root  4096 Sep 24 04:29  Music
drwxr-xr-x 1 root root  4096 Sep 14 20:22 'Music Stuff'
drwxr-xr-x 1 root root  4096 Sep 15 19:07 'PC Software'
drwxr-xr-x 1 root root  4096 Sep 14 20:43  Photos
drwxr-xr-x 1 root root  4096 Sep 14 20:59  Porn
drwxr-xr-x 1 root root     0 Sep 14 16:47 '$RECYCLE.BIN'
drwxr-xr-x 1 root root     0 Sep 14 21:09 'Software & ISOs'
drwxr-xr-x 1 root root     0 Sep 20 15:02 'System Volume Information'
drwxr-xr-x 1 root root 12288 Oct 10 23:09 'TV Shows'

我现在知道为什么 ls -a 在每一行上报告用户帐户“root”两次,也许一个是所有者,另一个是组,我不完全理解这一点。无论如何,这是我的 fstab...

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
UUID=5fc20f24-ba33-4e6b-818f-134b4186dc8b /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=CB15-B2F5  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
#line added for ETX-2GB
UUID=B8FCAECDFCAE84EA /media/ntfs ntfs-3g permissions,auto 0 0

桑巴大会

[global]
        server role = standalone server
        map to guest = Bad User
        usershare allowguests = yes
        hosts allow = 192.168.0.0/16
        hosts deny 0.0.0.xsudo 0/0

[NUC-testshare]
        comment = test share on NUC box
        path = /home/exharris/testshare/
        read only = no
        guest ok = yes
        force create mode = 0775
        force user = exharris
        force group = exharris

[NUC-EXT2-2TB-Plex]
        comment = 2TB Plex Media HDD
        path = /media/ntfs
        read only = no
        guest ok = yes
        force create mode = 0775
        force user = exharris
        force group = exharris

[NUC-testshare] 即 /home/exharris/testshare/) 工作正常,我可以通过 Samba 从 LAN 上的其他计算机读取/写入它

然而,虽然我可以从其他电脑通过 Samba 查看 [NUC-EXT2-2TB-Plex] 中的所有内容(即使我必须以“ben”身份登录),但我根本无法写入该文件夹(即使在实际的机器 SSH 登录)。

另外,作为用户 exharris,除非我使用 sudo,否则我根本无法写入该目录

    exharris@nucserv:/media/ntfs$ echo "test" > test.txt
    -bash: test.txt: Permission denied
    exharris@nucserv:/media/ntfs$ sudo echo "test" > test.txt
    -bash: test.txt: Permission denied
    exharris@nucserv:/media/ntfs$ echo "test" > test.txtecho "test" > test.txtecho "test" > test.txt
exharris@nucserv:/media/ntfs$ echo "test" > test.txt
-bash: test.txt: Permission denied
exharris@nucserv:/media/ntfs$ sudo echo "test" > test.txt
-bash: test.txt: Permission denied
exharris@nucserv:/media/ntfs$ echo "test" > test.txtecho "test" > **test.txtecho "test" > test.txt**
test

或许这也是大家所期待的......

我想要对 Plex 媒体有更多的控制权,因此建议我设置一个新的 Unix 用户“ben”,并将其与一个特殊的 plex 组关联起来

**getent passwd**
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-network:x:100:102:systemd Network Management,,,:/run/systemd/netif:/usr/sbin/nologin
systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd/resolve:/usr/sbin/nologin
syslog:x:102:106::/home/syslog:/usr/sbin/nologin
messagebus:x:103:107::/nonexistent:/usr/sbin/nologin
_apt:x:104:65534::/nonexistent:/usr/sbin/nologin
uuidd:x:105:110::/run/uuidd:/usr/sbin/nologin
avahi-autoipd:x:106:111:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/usr/sbin/nologin
usbmux:x:107:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin
dnsmasq:x:108:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin
rtkit:x:109:114:RealtimeKit,,,:/proc:/usr/sbin/nologin
cups-pk-helper:x:110:116:user for cups-pk-helper service,,,:/home/cups-pk-helper:/usr/sbin/nologin
whoopsie:x:111:117::/nonexistent:/bin/false
kernoops:x:112:65534:Kernel Oops Tracking Daemon,,,:/:/usr/sbin/nologin
saned:x:113:119::/var/lib/saned:/usr/sbin/nologin
pulse:x:114:120:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin
avahi:x:115:122:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/usr/sbin/nologin
colord:x:116:123:colord colour management daemon,,,:/var/lib/colord:/usr/sbin/nologin
hplip:x:117:7:HPLIP system user,,,:/var/run/hplip:/bin/false
mpd:x:118:29::/var/lib/mpd:/usr/sbin/nologin
sddm:x:119:124:Simple Desktop Display Manager:/var/lib/sddm:/bin/false
geoclue:x:120:125::/var/lib/geoclue:/usr/sbin/nologin
exharris:x:1000:1000:exharris,,,:/home/exharris:/bin/bash
plex:x:121:127::/var/lib/plexmediaserver:/bin/bash
sshd:x:122:65534::/run/sshd:/usr/sbin/nologin
ben:x:1001:126::/home/ben:/bin/sh
exharris@nucserv:/media/ntfs$ getent passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-network:x:100:102:systemd Network Management,,,:/run/systemd/netif:/usr/sbin/nologin
systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd/resolve:/usr/sbin/nologin
syslog:x:102:106::/home/syslog:/usr/sbin/nologin
messagebus:x:103:107::/nonexistent:/usr/sbin/nologin
_apt:x:104:65534::/nonexistent:/usr/sbin/nologin
uuidd:x:105:110::/run/uuidd:/usr/sbin/nologin
avahi-autoipd:x:106:111:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/usr/sbin/nologin
usbmux:x:107:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin
dnsmasq:x:108:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin
rtkit:x:109:114:RealtimeKit,,,:/proc:/usr/sbin/nologin
cups-pk-helper:x:110:116:user for cups-pk-helper service,,,:/home/cups-pk-helper:/usr/sbin/nologin
whoopsie:x:111:117::/nonexistent:/bin/false
kernoops:x:112:65534:Kernel Oops Tracking Daemon,,,:/:/usr/sbin/nologin
saned:x:113:119::/var/lib/saned:/usr/sbin/nologin
pulse:x:114:120:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin
avahi:x:115:122:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/usr/sbin/nologin
colord:x:116:123:colord colour management daemon,,,:/var/lib/colord:/usr/sbin/nologin
hplip:x:117:7:HPLIP system user,,,:/var/run/hplip:/bin/false
mpd:x:118:29::/var/lib/mpd:/usr/sbin/nologin
sddm:x:119:124:Simple Desktop Display Manager:/var/lib/sddm:/bin/false
geoclue:x:120:125::/var/lib/geoclue:/usr/sbin/nologin
exharris:x:1000:1000:exharris,,,:/home/exharris:/bin/bash
plex:x:121:127::/var/lib/plexmediaserver:/bin/bash
sshd:x:122:65534::/run/sshd:/usr/sbin/nologin
ben:x:1001:126::/home/ben:/bin/sh

2TB 磁盘的 UUID 已在 fstab 中列出,因此我没有遇到任何问题。

/etc/组=

root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:syslog,exharris
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:exharris
floppy:x:25:
tape:x:26:
sudo:x:27:exharris
audio:x:29:pulse
dip:x:30:exharris
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:plex
sasl:x:45:
plugdev:x:46:exharris
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
systemd-journal:x:101:
systemd-network:x:102:
systemd-resolve:x:103:
input:x:104:
crontab:x:105:
syslog:x:106:
messagebus:x:107:
mlocate:x:108:
ssl-cert:x:109:
uuidd:x:110:
avahi-autoipd:x:111:
bluetooth:x:112:
netdev:x:113:
rtkit:x:114:
ssh:x:115:
lpadmin:x:116:exharris
whoopsie:x:117:
scanner:x:118:saned
saned:x:119:
pulse:x:120:
pulse-access:x:121:
avahi:x:122:
colord:x:123:
sddm:x:124:
geoclue:x:125:
exharris:x:1000:
sambashare:x:126:exharris
plex:x:127:
rdma:x:128:

尝试访问时出现以下错误

文件或文件夹 smb://[电子邮件受保护]/NUC-EXT2-2TB-Plex 不存在。

从其他机器访问时是否必须以奇怪的方式输入凭据? EXT2-2TB 就在那里……

其他人可以帮忙吗,以便我可以通过 Samba 从 LAN 上的其他计算机写入 plex 文件夹?

答案1

最初对 ntfs 挂载缺乏写入能力感到惊讶,我注意到 fstab 文件中的“权限”选项。

这是一个 ntfs-3g 驱动程序选项,用于实现访问控制。从 fstab 中删除“权限”选项,文件应该可供所有人写入。

或者,为了更受控制的方法,请按原样保留 fstab 并使用 umask、fmask 和 dmask 的附加选项,此处列出了几个选项https://askubuntu.com/questions/92863/mount-ntfs-partition-at-startup-with-non-root-user-as-owner

有关用户和组的附加说明。我认为为面向网络的应用程序提供自己的用户并拥有执行类似任务的组是适当的,例如 Plex 和 Sickrage 可能位于“媒体”组中,对您的媒体驱动器具有写入权限,而其他用户只能具有读取权限。

相关内容