Entries filed under Uncategorized

Configure Plex Media Server Permissions on Ubuntu Linux

Posted on February 22, 2020

When Plex Media Server is installed on Ubuntu, it creates the user and group ‘plex’ that it runs under. The plex server therefore will be unable to access library files within /media/YOURUSERNAME/ folder where drives are typically automatically mounted.

So if you are struggling with permission denied errors, or Plex being unable to see folders, this tutorial will show you to fix that. The issue is due to Access Control Lists (ACL) that must be set properly to allow files created by your username to be accessed by the ‘plex’ user.

First, let’s add your username to plex. If your username for example is ‘john’ on the system, replace YOURUSERNAME in this command with that. It is case sensitive.

sudo usermod -a -G YOURUSERNAME plex

To verify that it worked, use the ‘group’ command to view the groups that plex is associated with:

groups plex

You should see an output from the terminal containing your username it should look like this, indicating that plex now has permissions with your username’s group:

plex : plex video YOURUSERNAME

Next, we need to add the ‘plex’ user to your user group, and allow it to access /media/YOURUSERNAME, along with permissions for the files. It allows the ‘plex’ group to read (r), write (w), and execute (x) files within the folders and subfolders.

(Warning: this command will set access control permissions for all subfolders and files within /media/YOURUSERNAME. This means that if you have any media like thumb drives, sd cards, or other disks that you don’t want these acl’s being applied to… remove them before running it.

If you have disks that you intend for your plex media server to use for its library, GOOD, leave those connected and mounted here!)

sudo setfacl -m g:plex:rwx -R /media/YOURUSERNAME

To verify that ACLs were set, use this comand on your media folder:

sudo getfacl /media/YOURUSERNAME

The output should look very similar to the following, and the important line to look for is the group:plex:rwx to verify success in configuration

getfacl: 
# file: media/YOURUSERNAME
# owner: root
# group: root
user::rwx
user:YOURUSERNAME:r-x
group::---
group:plex:rwx
mask::rwx
other::---

You should now be able to add the folders and drives from within /media/YOURUSERNAME/ to your plex libraries, without any permission issues.