2

minidlna will not access my pictures since adding a picture folder. Folder permissions for my pictures folder: drwxr-xr-x
minidlna status returns-

minidlna.c:674: error: Media directory "PV,/home/name/Pictures" not accessible [Permission denied]

It worked fine previously. How do I set the permissions for my media please? I have tried set user=root for /etc/default/minidlna and /etc/minidlna.conf followed by reload and restart, but still the same error code. Changed permissions to drwxrwxr-x but still not working. I am using Lubuntu 24.04 LTS.

kos
  • 41,378
Marty
  • 695
  • Are you sure PV is a valid media_dir configuration syntax? The man page for minidlna.conf states that "the letter ‘A’, ‘V’ or ‘P’, followed by a comma (‘,’) followed by the path" constitutes valid syntax for configuring a media_dir, but it nowhere mentions the ability to use more than one letter (nor it provides any example configuration using more than one letter) – kos Aug 25 '24 at 09:49
  • If you want to restrict a media_dir to a specific content type, you can

    prepend the directory name with a letter representing the type (A, P or V),

    followed by a comma, as so:

    * "A" for audio (eg. media_dir=A,/var/lib/minidlna/music)

    * "P" for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)

    * "V" for video (eg. media_dir=V,/var/lib/minidlna/videos)

    * "PV" for pictures and video (eg. media_dir=PV,/var/lib/minidlna/digital_camera)

    – Marty Aug 26 '24 at 09:07
  • Where are you getting that description from? It's not in the man page from Noble that I linked – kos Aug 26 '24 at 09:18
  • /etc/minidlna.conf – Marty Aug 26 '24 at 11:04
  • I see, can you try and set just "P" or "V" for the sake of excluding that the option is not being recognized (and maybe mistaken for a path that's not existing, something like that)? It could be an undocumented feature, that the example is mentioning depracated syntax that for some reason has been invalidated in newer versionsor or even downright a bug in the current version. Just to make sure. – kos Aug 26 '24 at 13:00
  • I have tried using just P, and also with no P or V completely which makes no difference to minidlna status. – Marty Aug 27 '24 at 08:37
  • I initially installed minidlna with sudo apt install minidlna. I notice that minidlna is no longer recognised by synaptic package manager. I have now installed minidlna-jdstrand from Discover, but it will not let me edit sudo vim /snap/minidlna-jdstrand/186/etc/minidlna.conf. It says the file is read only and I cannot overide with :w! – Marty Aug 27 '24 at 10:45
  • Uninstalled minidlna-jdstrand and found minidlna on synaptic package manage this time. Installed and edited configuration, but straight back to the same error message as before. Please help. – Marty Aug 28 '24 at 13:25
  • If the service / daemon is not running as root but as some other user (say minidlna), you'll need to make it so that that user is able to access the folder. Adding that user to your user's group could suffice, as that way it would at least be able to enter and read the contents of your home directory (750) and Pictures (755) – kos Aug 29 '24 at 17:57
  • Under the users tab in user & group settings, it says (minidlna id number 120 Full name MiniDLNAs... Group minidlna home directory of /var/lib/minidlna – Marty Aug 30 '24 at 10:17
  • 2
    I still don't know if the service is running as minidlna, however you could try sudo usermod -aG "$(id -gn)" minidlna, which will add minidlna to your primary group (you can verify this with groups minidlna). After that, restarting the service should be enough, but if it doesn't work try a reboot as well. – kos Aug 30 '24 at 10:27
  • That's it sudo usermod -aG "$(id -gn)" minidlna All working fine now. Thank you Kos. – Marty Aug 30 '24 at 14:15
  • You're welcome! I added a (IMO more reasonable) method to share the directory without having to leave minidlna in your primary group as an answer, perhaps you'll want to use that instead – kos Aug 30 '24 at 20:02

2 Answers2

1

sudo usermod -aG "$(id -gn)" minidlna This worked for me, thank you KOS

Marty
  • 695
0

Turns out, minidlna runs as the minidlna user which, per your home directory permissions (750), wasn't able to access anything in your home directory.

A reasonable approach to share personal media over DLNA in my opinion would be:

  1. Creating a directory for DLNA-shared media in /srv:

    sudo mkdir -p /srv/dlna/shared
    sudo chown minidlna: !$
    sudo chmod 700 !$
    
  2. Adding symlinks to directories to be shared in /srv/dlna/shared:

    sudo ln -s ~/Pictures /srv/dlna/shared/Pictures
    
  3. Making directories to be shared co-owned by minidlna:

    chgrp -R minidlna ~/Pictures
    find ~/Pictures -type d -exec chmod 2750 {} +
    find ~/Pictures -type f -exec chmod 640 {} +
    

Then adding /srv/dlna/shared/Pictures to /etc/minidlna.conf and making sure minidlna is configured to follow symlinks (wide_links=yes must be set in /etc/minidlna.conf).

This way, you won't need to add minidlna to your primary group, but all present (and future) files in ~/Pictures will be accessible by minidlna.

kos
  • 41,378
  • Thanks but no. Now minidlna is working at last I will stick with your first fix. Thanks again. – Marty Aug 31 '24 at 09:43