Plex

From eBower Wiki
Revision as of 19:56, 9 September 2016 by Jdbower (talk | contribs) (Created page with "I've been a long-time [https://www.plex.tv/ Plex] user, but it's been largely polished and not in need of documentation. However their new DVR solution has some quirks in that...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I've been a long-time Plex user, but it's been largely polished and not in need of documentation. However their new DVR solution has some quirks in that it's the first time I need to write to a directory.

Library Permissions

One option is to create a dedicated DVR directory. For example, I use /mnt/movies and /mnt/tv_shows. A trivial solution is to create /mnt/dvr/movies and /mnt/dvr/tv_shows with different permissions owned wholly by Plex. But I kind of like the idea of a merged library allowing me to pull DVR shows in the same searches and browses as non-DVR shows.

Group permissions are the key to this solution. I want to be able to write to a directory, but I also need Plex to be able to write to it. As such, I created a media group and added both myself and the plex user to it.

sudo groupadd media
sudo usermod -a -G media plex
sudo usermod -a -G media $USER

Then I need to create a directory and ensure that new files are owned by the group:

sudo mkdir --mode=u+rwx,g+rwxs,o+r,o-wx /mnt/movies
sudo chown plex:media /mnt/movies

Now you can touch test.txt in this directory and verify that it's owned by the media group. If you sudo su plex you should also be able to create a test.txt file.

Samba permissions

Samba creates a few other issues. First we'll want to ensure that the directory is writable in the /etc/samba/smb.conf configuration:

[movies]
   comment = Movies
   path = /path/to/movies
   guest ok = no
   writable = yes
   browseable = yes
   valid users = your_username, plex
   force group = media

In the Plex server's /etc/fstab you should have a line like the following:

//samba-server/movies /mnt/movies cifs credentials=/etc/smbuser/plex,_netdev,noauto,defaults,noperm 0 0

The /etc/smbuser/plex file is very simple:

username=plex
password=plaintext_password

If course, you'll want to sudo chmod 600 /etc/smbuser/plex and not use a very important password here.