Server Version#:22.04.1
Player Version#:
New to Linux and really only using it to gain access to HW Tonemapping. I’m trying to set up the Plex server on Ubuntu 22.04.1 and have my NAS folder containing my media mapped under Files, Networks, but when I browse for Media Folder while Adding a Library on Plex the folder does not show up to add it. I’ve searched all over and although there are hints at what might be the problem, I have not been able to find step by step instructions on what is wrong and how to fix it. Can anyone point to a fix for this or what additional details I need to provide? Thanks!
It’s probably easiest to mount that network share to your local file system.
This way you should also be able to ensure the service user running your PMS has access to the media (plex:plex).
From Linux Tips
Thanks so much! I’ll see if I can make sense of all that.
So I have followed the steps linked above but have run into an issue. All of my files are under the Home folder of the admin account on my NAS. The guide says to use plex as the user but the home files seem to be exclusive to each account and therefore inaccessible by other accounts. Can I set the user as admin instead of plex so I can see the files there? Does that hurt anything? I really don’t want to have to move my files. Thanks!
This is basically two separate sets of credentials.
If you mount a network share, you’ll need the credentials of the NAS to access the share (whatever NAS admin account you’re using for the media).
You’re then integrating it into the local file system where it’ll be linked to a local account of your Linux setup (preferably plex).
So where would the plex user be replaced with admin in the links above and the excerpts below? Everything is just plex in the links so I can’t tell which corresponds to the NAS credentials versus the local account on Linux. Thanks!
username=plex
password=password
//qnap/share/cartoons /nas/cartoons cifs auto,defaults,nofail,credentials=/etc/plex.cred,uid=plex 0 0
In your given example, you’re configuring /etc/fstab to point to an external file containing your NAS credentials (/etc/plex.cred). In that case, the credentials file must store the NAS credentials (e.g. the NAS admin account and password).
I have an Asustor NAS so it’s neither example.
So I can put username=admin and password=adminpassword rather than username=plex and password=plexpassword?
I did try it but when I did Plex no longer sees the shares. At least with plex as the username in that file plex.cred file I could select the shares for adding to the library but then I am dealing with them being empty because I am pointing to the wrong home folder evidently.
This is my original fstab entry:
//192.168.1.52/home/ /nas/home/ cifs auto,defaults,nofail,credentials=/etc/plex.cred,uid=plex 0 0
//192.168.1.52/home/Videos /nas/home/Videos cifs auto,defaults,nofail,credentials=/etc/plex.cred,uid=plex 0 0
//192.168.1.52/home/Videos/Movies /nas/home/Videos/Movies cifs auto,defaults,nofail,credentials=/etc/plex.cred,uid=plex 0 0
//192.168.1.52/home/Videos/TV\040Shows /nas/home/Videos/TV Shows cifs auto,defaults,nofail,credentials=/etc/plex.cred,uid=plex 0 0
//192.168.1.52/home/Music /nas/home/Music cifs auto,defaults,nofail,credentials=/etc/plex.cred,uid=plex 0 0
//192.168.1.52/home/Music/Hi\040Fidelity\040Music\040Downloads /nas/home/Music/Hi Fidelity Music Downloads cifs auto,defaults,nofail,credentials=/etc/plex.cred,uid=plex 0 0
I used this to make the directories:
sudo sh
mkdir nas/home nas/home/Videos nas/home/Videos/Movies nas/home/Videos/TV Shows nas/home/Music nas/home/Music/Hi Fidelity Music Downloads
chmod -R 755 /nas
exit
Also, I read you need to use \040 in place of spaces but I am not entirely sure where the spaces cause problems. Should ALL spaces in the above files be \040 or just certain ones? Thanks!
I tried using nfs instead of cifs as shown in the example in the linked guide but that also did not work. So my question boils down to what do I have to change in the guide linked above to use my NAS’ admin account rather than the suggested plex account? I have tried everything I can think of as far as changing “plex” to “admin” for the user but I think maybe I shouldn’t be changing them all to admin from plex. The guide doesn’t really explain the reasoning for any of the choices used and thus adapting to my situation has proven difficult for me as a Linux illiterate. It really is hard to fathom that something as mundane as accessing a NAS in Plex has to be this hard in Linux.
So what I believe is necessary is to change the Plex user to admin. From what I can gather this requires indirectly modding the plexmediaserver.service file. I will experiment, but it would have been nice for Plex to expose this in the settings interface.
Those credentials are separate.
This isn’t a Windows system where the name of the Windows account must match that of a remote/network share in order to access it.
Consider it two pairs of keys… one to open the content on your NAS, one to open the file system. The account/key of your Linux file system won’t help opening the NAS and the account/key of your NAS won’t help opening your Linux file system – they’re independent keys/locks.
As for the documentation of mounting a share… there’s some user guides on the Ubuntu homepage detailing the different attributes and their meaning (with examples).
https://help.ubuntu.com/community/Fstab
breaking down your original /etc/fstab info to the sections explained in their guide:
| Field | Your Parameter | Description |
|---|---|---|
| Device | //qnap/share/cartoons |
The device/partition (by /dev location or UUID) that contain a file system. |
| Mount Point | /nas/cartoons |
The directory on your root file system (aka mount point) from which it will be possible to access the content of the device/partition (note: swap has no mount point). Mount points should not have spaces in the names. |
| File System Type | cifs |
Type of file system (see LinuxFilesystemsExplained). |
| Options | auto,defaults,nofail,credentials=/etc/plex.cred,uid=plex |
Mount options of access to the device/partition (see the man page for mount). |
| Dump | 0 |
Enable or disable backing up of the device/partition (the command dump ). This field is usually set to 0, which disables it. |
| Pass Num | 0 |
Controls the order in which fsck checks the device/partition for errors at boot time. The root device should be 1. Other partitions should be 2, or 0 to disable checking. |
[Edit: transposed the table for better readability]
As for replacing spaces in a file path by \040… just escaping the space character will do the trick (e.g. //192.168.1.52/home/Music/Hi\ Fidelity\ Music\ Downloads); alternatively you should be able to put the path in quotes (e.g. "//192.168.1.52/home/Music/Hi Fidelity Music Downloads") – this will depend a bit on the specific app/use case where you apply it.
Thank you that is most helpful! It looks like somewhere along the line I took a step backward. Even with plex everywhere as the user, I am no longer seeing those mount points in Plex when I browse to add to the library. I am not certain if Linux ever was able to mount the NAS or not but it definitely isn’t now. I whittled the fstab portion down to just one share with one file in it, but when I attempt to mount it, Linux reports access denied. I have the appropriate credentials in the plex.cred needed to access the share. The fstab path is the same as my Windows share which mounts fine.
//192.168.1.52/Media /nas/Media cifs auto,defaults,nofail,credentials=/etc/plex.cred,uid=plex 0 0
I do have the nas/Media directory in place and applied the chmod -R 755 /nas command to it but it will not show up in Plex and Linux does not mount the //192.168.1.52/Media portion.
I am going to try enabling NFS on the NAS and see if that works at all.
NFS did not work, BUT I was able to see my files with cifs after I installed smbclient and using a less secure fstab entry that exposes my password. I am not sure why the secure fstab with the credentials file fails while the exposed entry works. Any ideas?
Works:
//192.168.1.52/Home /nas/Home/ cifs username=admin,password=*,iocharset=utf8,file_mode=0777,dir_mode=0777
Fails:
//192.168.1.52/Home /nas/Home/ cifs auto,defaults,nofail,credentials=etc/plex.cred,uid=admin 0 0
Referenced /etc/plex.cred file:
username=admin
password=*
What do I have to change with my second fstab entry to make it work? Actually does it even matter if I use one or the other?
One thing I am also noticing is that although the solutions mentioned for handling spaces work in the below temporary mount command, they do not seem to work when used in fstab.
sudo mount -t cifs -o username=admin //192.168.1.52/Home/Videos/TV\ Shows /nas/Home/Videos
Edit: It seems it has to be \040 in place of any spaces in the directory path. In fstab this works.
how did you setup permissions for the credentials file (/etc/plex.cred)?
the guide linked above suggests it should be owned by root, e.g.
sudo chown root.root /etc/plex.cred && sudo chmod 400 /etc/plex.cred
Edit: if you can mount it manually with the same credentials but it fails using /etc/fstab that implies there might be something wrong with the credentials file
The cred file is owned by root.
Alright well I never could get the guide’s method to work exactly but it is working using the below fstab entry and installing smbclient as mentioned above. Thank you Tom80H for getting me in the right direction.
//192.168.1.52/Home /nas/Home/ cifs username=admin,password=*,iocharset=utf8,file_mode=0777,dir_mode=0777
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.