User Tools

Site Tools


ubuntu:plex:configure_plex_media_server

Ubuntu - Plex - Configure Plex Media Server

Create the directories that will store the Plex media files:

sudo mkdir -p /mnt/{tv,movies}
sudo chown -R plex: /mnt

NOTE: The Plex Media Server runs as the user plex, which must have read and execute permissions to the media files and directories.

  • The chown command sets this correct ownership.

Use Media on another system

To allow connecting to an Samba Share, install CIFS.

sudo apt install cifs-utils

Manually mount the remote content

sudo mount -t cifs -o username=peter,password=some_strong_password,uid=peter,gid=peter,forceuid,forcegid,vers=2.1 //192.168.1.35/Movies /mnt/Movies/
 

NOTE: set the username and password as required.

NOTE: The problem with this manual mount option includes:

  1. The mount gets forgotten at boot.
    • It would make sense to have the mounts automatically be enabled whenever the system is rebooted.
  2. The username and password are written to the log files. This is a security risk.
    • It would be best to hide these.

To hide the Samba Password from being included directly into the mount command

Create a credentials file, .smbcredentials:

.smbcredentials
username=peter
password=some_strong_password
#domain=optional_domain_or_workgroupname

NOTE: The credentials file starts with a dot, which makes it a hidden file.

  • Set the username and password as required.
  • Uncomment the domain part by removing the hash sign in front if this is needed.

Set the permissions on the Credentials file

chmod 0600 ~/.smbcredentials

NOTE: The 0600 makes this file only read accessible to the user.

  • chmod 0600 (chmod a+rwx,u-x,g-rwx,o-rwx,ug-s,-t) sets permissions so that, (U)ser / owner can read, can write and cannot execute.

Have Plex Shares automatically load at boot

Add the following lines to /etc/fstab:

/etc/fstab
#Plex
//192.168.1.35/Movies /mnt/movies cifs credentials=/home/peter/.smbcredentials,uid=peter,gid=peter 0 0
//192.168.1.35/TV /mnt/tv cifs credentials=/home/peter/.smbcredentials,uid=peter,gid=peter 0 0

NOTE: This references the credentials file.


Test that this configuration works to mount the Samba shares

sudo mount -a

NOTE: This should automatically mount the shares shown in the /etc/fstab file.

Confirm this by looking at the share directories, in this case:

  • /mnt/movies
  • /mnt/tv

Configure the Plex GUI

Open a Web Browser, and type http://YOUR_SERVER_IP:32400/web, and you will be redirected to the plex website:


References

ubuntu/plex/configure_plex_media_server.txt · Last modified: 2021/11/19 10:26 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki