Mount CIFS share as a symlink in Plex Media Server for the Camera Upload feature

    • OMV 2.x
    • Resolved
    • Mount CIFS share as a symlink in Plex Media Server for the Camera Upload feature

      Hi everyone!

      First of all I want to thank the OMV team for such a great software!

      I'm doing something rather complicated (for my poor linux skills!) and i'm looking for some help! Here is my setup : I have one NAS (rooted WD MyCloud 2TB) running the latest OMV Stoneburner and an Odroid XU4 (eMMC 16GB) running Debian jessie Headless.

      Plex Media Server is installed on the Odroid XU4 (better processing power than the WD MyCloud). What I'm doing is mount all the shares created on the OMV NAS (i.e. music and videos) in the Odroid XU4 /mnt/samba/mycloud/* folder so I can scan them from the PMS web interface. For now it works perfecty. First I tried to mount the OMV 'photos' share directly in '/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Media\ Upload/Photos/' with no success. I then found a tutorial suggesting to create a symlink with the 'Photos' name redirecting to the folder (local folder, not a samba share) where you want the mobile photos uploaded.

      So what I did is temporarely mount the Photos share, and created the symlink :

      Source Code

      1. sudo mount -t cifs //OMVSERVER_IP/photos /mnt/samba/mycloud/photos -o credentials=/root/.smbcredentials
      (where .smbcredentials contains username=USERNAME,password=USERNAME_PASSWORD)

      Source Code

      1. sudo ln -s /mnt/samba/mycloud/photos /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Media\ Upload/Photos


      I changed the owner and group to plex:nogroup :

      Source Code

      1. sudo chown -h plex:nogroup /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Media\ Upload/Photos


      The photos are "uploaded" to PMS but I can't find them in the 'Photos' share. And I can only see the thumbnails in the Plex app. In Odroid XU4, I ckecked the user:group on /mnt/samba/mycloud/photos and it is 'root:user' (default when OMV creates a share). To test, in the NAS OMV, I created a 'plex' user assigned with 'nogroup' then changed the 'Photos' ACL the plex:nogroup. When I checked the the user:group again in Odroid XU4, it showed 1005:nogroup. So my guess is that the UID for the plex user in the NAS is not the same in Odroid XU4. Indeed the default plex UID in the latter is 108.

      What can I do to make it work without messing with my PMS config? Can I change the plex UID? Do you have another suggestion? Idea?

      Thanks!

      PS. Sorry for my bad english ;)

      The post was edited 2 times, last by blais708 ().

    • tekkb wrote:

      I say 2 things and maybe I come back...

      You can use the remote share plugin to mount a share from another device on your OMV.

      The chown plex is using is plex:plex, not plex:nogroup.


      True, I could install OMV on the Odroid XU4 and create a samba/cifs share from the Plex 'Photos' Library but that not what I want. First the Odroid XU4 is limited in space (16GB) and I want it to act as a "control" server, I want all my data stored in MyCloud.

      As for the chown plex is using, I didn't change anything when installing PMS :

      Source Code

      1. root@odroid:/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Media Upload$ ls -la
      2. total 8
      3. drwxr-xr-x 2 plex nogroup 4096 Jan 31 17:51 .
      4. drwxr-xr-x 12 plex nogroup 4096 Jan 31 18:04 ..
      5. lrwxrwxrwx 1 plex nogroup 26 Jan 31 17:51 Photos -> /mnt/samba/mycloud/photos/


      Thanks for your help!
    • OK... But I just want to remind that I have two machines : one that serve as a nas with OMV where I want all my data stored (Server #1), and another stock Debian Jessie Headless server with Plex Media Server installed (Server #2).

      Plex is not installed on the Server #1 via OMV plugin. Since Plex is installed on Server #2, OMV on Server #1 doesn't «deal» with Plex. What I'm trying to do is to make the Plex App upload my mobile photos in a 'photos' share on Server #1 via Plex Media Server on the Server #2. Server #1 doesn't have enough processing power to handle PMS properly.

      I feel that when I chown a directory a user:group, it assigns instead the associated UID:GID and that information sitcks with the directory wether it's being seen by Server #1 or Server #2. Since I created a user named « plex » on Server #1, it automatically assigned the UID 1005 to it. By making 'plex' the owner of the share 'photos' on Server #1, Server #2 sees it as 1005, where the latter isn't assigned to any user in Server #2. Since the UID of 'plex' user on Server #2 is 108, and that the UID 108 is assigned to 'avahi' user on Server #1, I'll try to make 'avahi' member of the group 'nogroup' on Server #1 and chown avahi:nogroup on the share 'photos', to make the Server #2 think it's plex:nogroup... I'll report back wether it works or not.

      Cheers!
    • It works...partially. As described in the previous post, changing the ACL of the share 'photos' on Server #1 to avahi:nogroup, on Server #2 it is seen as plex:nogroup, but still the photos won't appear in the 'photos' share on Server #1 when uploaded. But when I create a text file as root in two ways on Server #2 :

      Source Code

      1. nano /mnt/samba/mycloud/photos/test1.txt
      2. nano /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Media\ Upload/Photos/test2.txt


      I can see both new files in the share 'photos' on the Server #1

      But if I do the same as a normal user without sudo command, I get a 'permission denied' in nano when trying to save the files... So for now I guess that's why PMS can't write the images in the share...

      Any ideas?

      Thanks!
    • Hi,

      Yes it's exactly what I'm trying to do, and it works! On the Server #2, I changed the fstab file to mount the share on Server #1 like this :

      Source Code

      1. //SERVER_#1/photos /mnt/samba/mycloud/photos cifs credentials=/root/.smbcredentials,iocharset=utf8,uid=108,rw 0 0


      Where the UID is the 'plex' user on Server #2.

      Today, I'll try to see if this could work without messing with the ACL on the share 'photos' en Server #1 and post all the steps required to make it work if someone else is interested to do it too.

      I think there would be a way to automated this if there were some kind of standards like some specific UIDs reserved to some particular usernames (i.e UID=0 for root on most UNIX systems)

      Cheers!
    • Hi again,

      So after doing some verifications, changing the ACL values on the share 'photos' on OMV side (Server #1) doesn't change anything since the uid=xxx,gid=xxx mount option in fstab overwrites the ACL. To make the Plex mobile app upload the photos to any samba/cifs share do the following prior to activating the Camera Upload feature on the app settings :

      Create a file where the share user name and password to be mounted will be stored

      Source Code

      1. sudo nano /root/.smbcredentials


      Source Code

      1. username=USERNAME
      2. password=PASSWORD


      Source Code

      1. sudo chown root:root /root/.smbcredentials
      2. sudo chmod 600 /root/.smbcredentials


      check the chown values of your plex folder:

      Source Code

      1. ls -la /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/


      In my case it is plex:nogroup, now check the associated user id (uid) and group id (gid) :

      grep plex /etc/passwd
      grep nogroup /etc/group

      As mentionned by tekkb, the gid could be 'plex' on i386 and amb64 architectures. Now, in /etc/fastb, mount your desired share :

      Source Code

      1. sudo nano /etc/fstab


      Source Code

      1. //REMOTE_SERVER/SHARE_NAME /mnt/MOUNTING/LOCATION cifs credentials=/root/.smbcredentials,iocharset=utf8,uid=PLEX_UID,gid=NOGROUP_GID,rw 0 0


      Now Reboot, I like to make sure that the share is properly mounted by creating a dummy file/folder in the share from the host machine. Then 'ls -la /mnt/MOUNTING/LOCATION', if you can see the dummy file/folder listed, your good to go! Now let's create a symlink in the plex «Media Upload» directory with the Library name you want (remember it, we'll use it in the Plex App later), or use the default 'Mobile Photos' pointing to the mounted share and chown the appropriate user:group :

      Source Code

      1. ln -s /mnt/MOUNTING/LOCATION/ /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Media\ Upload/Mobile\ Photos
      2. chown -h plex:nogroup /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Media\ Upload/Mobile\ Photos


      On your mobile device, navigate to the Plex App settings, go to Camera Upload, if you used 'Mobile Photos' as the symlink name you do not need to change de Library name, it's the default. But if you chose another one use the exact same name as the symlink. You can create an album if you want (useful if you have multiple devices linked to your Plex Media Server, ie. you can sort your pictures by devices' name). Finally activate the camera upload feature! Voilà!

      Cheers!

      The post was edited 2 times, last by blais708 ().