Ubuntu - permissions changes to fix to access media files

Server Version#: 4.180.0
Player Version#:

Hi folks.

Ive been trolling through this forum - trying to work out the right commands for permissions on my new ubuntu install so that plex can see the media directories.

Going back a step before solving for plex heres the current config:

  1. Installed SabNZB, radarr & sonarr - they are running using user = root - i know i should probably change this, but want to get everything working first before i do
  2. my username = matt
  3. installed plex media server, username = plex
  4. added root, plex and matt users to group called media
  5. set up my 2nd hard disk (SSD) with owner = matt, and Group = media

Sab, radarr and sonarr are working fine - downloading and storing files on disk = media

Plex up and running fine but when I try and add the directories plex doesnt seem to index the files in movies and tv. I gather its a permissions issue, although I assume that plex gets permission from the group permissions on the media directory?

Help. please :slight_smile:

I use Sonarr.

Permissions mask is simple: 755 directory permissions. Permissions are applied as files/directories are created.

You set yourself as owner of the media. The 755/644 resultant permissions allow Plex to work regardless of the group.

PMS minimally needs read permission. That’s it.

could I possibly ask you to share the command/s please?

is it:

sudo find /media -type d -exec chmod 755 {} ;

sudo find /media -type f -exec chmod 644 {} ;

How does that apply then to the user: plex

Here’s the actual settings in Sonarr.

As Sonarr imports, directories get 755, files get 644, which is exactly what you want.

The find / chmod command you show is correct.
The chown should be such that your UID owns the files.
This results in plex having Read-only access to the media every time.

One problem you do have is the /media directory.
If this is a HDD mounted by the automounter, Plex will NOT have any access.
Automounts are exclusive to your user id.

You must mount somewhere else to avoid conflict.

This is the documentation I wrote

1 Like

boom this must be the issue (that I didnt realise was a thing!) thanks Ill work through this and revert

Half way through and im a wee bit confused.

df:

matt@LANDOGNUC:/$ df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1624224 2024 1622200 1% /run
/dev/sda2 490617784 15076964 450545340 4% /
tmpfs 8121120 8 8121112 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
/dev/sda1 523244 14604 508640 3% /boot/efi
tmpfs 1624224 128 1624096 1% /run/user/1000
/dev/sdb1 1921724608 13343036 1810689516 1% /media/matt/Media

Ive done the mkdir, verified permissions:

drwxr-xr-x 3 matt matt 4096 Nov 26 13:37 .
drwxr-xr-x 21 root root 4096 Nov 26 13:37 …
drwxr-xr-x 2 matt matt 4096 Nov 26 13:37 Media2

about to edit fstab, question:

am i only making an entry here for the dev/sdb1 (where the media is maintained), or

Am I supposed to also make an entry for the main HD where ubuntu is installed as well?

I have some media files under /sata (SATA SSD in the NUC)

# SATA
/dev/sda1              /sata                  xfs     defaults,auto,noatime    0   3

The cheat-sheet rules are:

  1. mkdir
  2. chown
  3. chmod
  4. edit /etc/fstab
  5. mount /mount_dir (confirms the mount point & fstab entry are valid)
  6. ls -la /mount_dir
  7. If perms need setting (in the file system) set them here

Note: You set perms on the base dir (before mount) and then in the file system after mount. That’s the trick

exactly my config (i.e. SSD in a NUC).

The NUC has 2 SSD drives - one 500GB one where ubuntu is installed and one 2TB one (the media storage SSD)

So yep im at step 4 in your list - im just asking (sorry im a noob) i only need to add an entry in fstab for the 2 TB media drive right? not the main ubuntu drive?

incidentally the main media storage drive is /dev/sdb1 1921724608 13343036 1810689516 1% /media/matt/Media

update

i pushed on and added both SSD’s but coudnt mount the SSD with unbuntu installed as it was already mounted. so I commented it out for now.

heres what fstab looks like:

Addtions for external and internal drives

Mount Media2 (ext4) at /disks/media2 for Plex

UUID=a249f0c8-3473-4da1-8117-2e5e82a04a70 /disks/Media2 ext4 defaults,auto,rw,nofail 0 1

Mount /dev/sda2 directly READ-ONLY, and use the device name because it will never change

/dev/sda2 /disks/c ext4 defaults,auto,ro,nofail 0 1

ive since done the permissions set, added the libraries for tv and movies in plex by navigating to Media2 directory and all is working.

So I wanted to thank you, oh and also check that I havent done anything silly in fstab?

Cheers youve saved my life!

1 Like

You got it!

Don’t you just LOVE Nautilus? :rofl:

You can change the /disks mount point to ANYTHING you want.
You can see I used /sata .

You’re free to use anything which doesn’t conflict / already reserved.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.