As default, PMS is installed as user plex, group plex, secondary membership to video, not login capabile, no root priv
When you setup the share permissions, there’s no need to get too fancy. I leave mine open because my home LAN is safe and I write to the share when I rip.
The local NFS mount should be as clean (I enable and use NFSv4)
To put PMS back into its default configuration.
Remove whatever you did to make it root. (/etc/systemd/system/plexmediaserver.service.d/override.conf ?)
remove the package
userdel plex
groupdel plex
When you install again, it will likely not start because of permissions to the metadata in /var/lib/plexmdiaserver
Install PMS
Stop PMS
sudo chown -R plex:plex /var/lib/plexmediaserver
Start PMS
NFS mount vienna:/movies /vie/movies nfs intr,rw,vers=4,auto,async,nofail,bg 0 0
As default, PMS is installed as user plex, group plex, secondary membership to video, not login capabile, no root priv
So, I created the plex user manually, and looking at his groups - he is part of the video group. His UID:GID is 1001:1001. He has /bin/bash for login and no entry in the sudoers file.
I’m really hoping that editing /etc/passwd to /sbin/nologin and removing his home and mail-spool directories will suffice. I really don’t want to uninstall and reinstall PMS.
When you setup the share permissions, there’s no need to get too fancy. I leave mine open because my home LAN is safe and I write to the share when I rip.
The problem is that all the files ripped by sabnzbd get owner:group sabnzbd and permission 644. So I either need to have sabnzbd set the permissions to 777 (or 776) or have all the services in the same group. Having them in the same group and tightening the permission seems to be best practice?
My home LAN is not safe. Yet. When I got all this up and running I’m going to set up nginx and certificates.
The local NFS mount should be as clean (I enable and use NFSv4)
From the looks of it, we use the same settings (apart from IP lockdown) and I also use NFSv4.
On the client I use defaults. I’m not sure how that stands against the settings you have.
Where did you place Plex’s home directory? When creating by hand, it gets placed in /home/plex.
We put it in /var/lib/plexmediaserver because it is then part of the root filesystem. This guarantees it has exec privilege for the codecs. /home is not guaranteed to have this privilege in the mount. Granted it can be moved (with an override) but it’s a step in the process to check when /home is a separate partition.
/sbin/nologin is all you need to set. Make sure you don’t leave /etc/passwd writable when done and all good on security
regarding permissions, you need to look at the Linux sticky bit (inheritance) It can do all kinds of neat tricks.
regarding defaults, do the man fstab and also look at the others. defaults is a little looser than what I did. I locked down how I wanted the connection made… It’s up to you there.
Since QNAP is also Linux, those same sticky bit functions exist in its kernel. Linux -> Linux via NFS and it’s flawless. All you need now is a little UID matching (edit /etc/passwd) and it’s all set. Personally, I would track UID between workstation and QNAP. Let GID float to be ‘everyone’ on QNAP (the default).
Ok, I need to break this down a little further, a lot of this is new to me. Trying to learn as I go along, thanks for your patience.
@ChuckPa said:
Where did you place Plex’s home directory? When creating by hand, it gets placed in /home/plex.
Result from ls -l /home/plex: drwxrwxr-x. 2 plex plex 60 Feb 5 13:33 Downloads
Downloads only contains the pms .rpm
This is the entry in /etc/passwd: plex:x:1001:1001:Plex Media Server User:/home/plex:/bin/bash
We put it in /var/lib/plexmediaserver because it is then part of the root filesystem.
Looking in /var/lib/, I find this drwxr-xr-x. 3 plex plex 21 Feb 10 21:29 plexmediaserver (see screenshot below)
While sabnzbd for instance has drwxr-xr-x 8 root root 97 Feb 12 22:34 sabnzbd
This guarantees it has exec privilege for the codecs.
From the screenshot above it looks correct?
/home is not guaranteed to have this privilege in the mount.
“in the mount” confuses me here. I only have one disk in the centos machine, no partitions (apart from efi, and recovery). The only thing that is placed on the QNAP via the NFS mount are the libraries “Movies” and “Series” (TV shows).
Granted it can be moved (with an override) but it’s a step in the process to check when /home is a separate partition.
usermod -m -d /var/lib/plexmediaserver plex ?
Will that fix the /etc/passwd-entry?
/sbin/nologin is all you need to set. Make sure you don’t leave /etc/passwd writable when done and all good on security
Cool. It has -rw-r--r-- 1 root root 1222 Feb 12 22:34 /etc/passwd
Which according to this is correct? If I edit it as root I don’t have to change permissions, right?
regarding permissions, you need to look at the Linux sticky bit (inheritance) It can do all kinds of neat tricks.
Wow, that was a lot to take in. Need to read it a couple of times and let it sink in.
Since QNAP is also Linux, those same sticky bit functions exist in its kernel. Linux → Linux via NFS and it’s flawless. All you need now is a little UID matching (edit /etc/passwd) and it’s all set. Personally, I would track UID between workstation and QNAP. Let GID float to be ‘everyone’ on QNAP (the default).
This is what it looks like on the QNAP:
lrwxrwxrwx 1 admin administ 15 Feb 17 14:44 Movies -> HDB_DATA/Movies/ lrwxrwxrwx 1 admin administ 15 Feb 17 14:44 Series -> HDB_DATA/Series/ drwxrwxrwx 6 admin administ 4096 Feb 8 15:32 HDB_DATA/ drwxrwxrwx 30 admin administ 12288 Feb 18 00:16 Movies/ ← in HDB_DATA/ drwxrwxrwx 26 admin administ 4096 Feb 18 00:12 Series/ ← in HDB_DATA/
The content that was already there on the QNAP (I’ve gone from macOS to CentOS) has this: drwxrwxrwx 3 plex everyone 4096 Feb 11 14:18 Krakel Spektakel (2014)/
While content added since the OS change, has this: drwxr-xr-x 2 998 996 4096 Feb 18 00:45 The Usual Suspects (1995)/
That UID and GID comes from this guy on the workstation (centos): sabnzbd:x:998:996:SABnzbd:/usr/share/sabnzbd:/bin/sh
This is the plex user on the QNAP: plex:x:501:100:Linux User,,Plex Media Server user,:/share/homes/plex:/bin/sh
i have followed these excellent steps but I think the instructions are missing something in the firewall file xml. I created the file using the steps.
<?xml version=“1.0” encoding=“utf-8”?> plexmediaserver Plex TV Media Server
but I"m sure there are supposed to be more in it than just this. when I try to add the service ‘plexmediaserver’ using the command ‘firewall-cmd --permanent --add-service=plexmediaserver’ it tells me
‘Error: INVALID_SERVICE: ‘plexmediaserver’ not among existing services’
updated:
I found some guides on firewalls and I tried this:
<?xml version="1.0" encoding="utf-8"?>
plexmediaserver (Plex TV Media Server)
Plex TV MEdia Server.
I followed these instructions and all was working, but I had a power outage and my PMS server went down and now when I boot CENTOS 7 I get prompted for a password for root@@///video with this message “Please enter password with the systemd-tty-ask-password-agent tool!”. I get this every time I reboot the PMS server and enter the password I am not able to access the share on my NAS. Does anyone know how to fix this issue? I have googled this issue with no luck at all. I checked my fstab file all looks good according to the article. I am not sure what is going on. Any information would be a great help. Thank you in advance.