@jamesmacwhite said:
@DigitalArtifex
I echo similar points you’ve made when I originally followed this.
Firstly, thank you to OP for writing this guide. I used it to help migrate my Plex install from Windows Server 2012 R2 to CentOS 7. There were some areas I did differently based on my own views/security.
Plex doesn’t need to be root
The Plex user does not need to have root elevation or even have the ability to login. In newer versions of PMS the rpm package will automatically created a Plex user account. By default it has its shell set to /bin/false, meaning you can’t login into the user via SSH or console. You should really consider keeping it this way. Unless you are running some really bespoke setup and understand the risks, the Plex user does not need to be elevated to root or have a shell for login abilities at any point.
If you want SSH access, create a separate user account for general management/maintenance that isn’t root.
Additionally, as Plex Media Server runs as a proper service (unlike Windows), the permissions and elevation will be handled by systemd. No jacket sudo required. The only thing to ensure is all Plex related directories are assigned to the plex user plex:plex. You can use:
chown plex:plex <directory> # Directory only
chown -R plex:plex <directory> # Recursive
Note: You do not need to use chown on CIFS shares, as the UID and GID controls the ownership.
You can modify the default paths after Plex Media Server is installed such as the Plex home directory (default /var/lib/plexmediaserver) which is totally fine. Changes to these paths and other configs values can be done in /etc/sysconfig/PlexMediaServer.
Samba shares
Regarding samba shares part, the special user and group created is not necessary. You can directly mount CIFS shares via the UID and GID of the plex user without any issues and in fact I would recommend doing so.
As the user is auto created by the rpm you can simply run the following and use numeric values reported back in /etc/fstab
id -u plex # Get UID
id -g plex # Get GID
I actually had problems using the mentioned samba groups with the Optimised Versions feature. I got various permission and write errors every time I tried to use it, turns out its because of permissions on the CIFS mounts, despite adding the plex user assigned the group. Mounting with the plex user directly resolves the issue.
Additional firewall issues with firewalld
In addition to the well documented Plex ports required to be opened, firewalld didn’t play nice with RasPlex and blocked the ability to connect to Plex HT for remote control. This is likely due to multicast filtering and its a pain in the butt to add a rule for these data packets. In the end I gave up and essentially whitelisted my RasPlex device outright.
firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="xx.xx.xx.xx" accept'
Hope this helps in addition to excellent guide written.
If I want to add one more layer by adding deluge-daemon as another service. How should I configure the permissions?
My current thought is that I would keep the default deluge:deluge user and group and have it write files using 775 permission so that plex:plex can have access. I would configure Samba using the forceuser/forcegroup option to have it save files as deluge:deluge. I would then add my normal user account to the deluge group so I can modify the files through SSH if I want. Do you think this would be a nice configuration for the permissions or any other better options?