Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MiniDLNA: File Permissions #147

Closed
mcnesium opened this issue Nov 13, 2021 · 2 comments
Closed

MiniDLNA: File Permissions #147

mcnesium opened this issue Nov 13, 2021 · 2 comments
Labels
question Further information is requested

Comments

@mcnesium
Copy link

mcnesium commented Nov 13, 2021

I run a Nextbox, which basically is a Nextcloud instance running in Docker on a Raspberry Pi. Nextcloud does not (yet?) support serving media via DLNA and the workaround is to just use MiniDLNA. Since maintenance of this Nextbox is done by Nitrokey, I do not want to mess with the host system too much, and rather run MiniDLNA also within Docker, so this is how I got here.

The media files in the Nextcloud data directory are in a Docker volume, which is no problem to mount also in the MiniDLNA container. But they are of course owned by www-data:www-data, so they can not be accessed by MiniDLNA:

[2021/11/13 16:25:30] minidlna.c:670: error: Media directory "/nextcloud/data/me/files" not accessible [Permission denied]

I tried to solve this by adding the environment variable MINIDLNA_USER=33 (UID of www-data) to this container, but this UID is assigned to another user xfs in this Alpine-based MiniDLNA container and so this gave me even more errors and resulted in the container exiting:

[2021/11/13 16:27:43] minidlna.c:670: error: Media directory "/nextcloud/data/me/files" not accessible [Permission denied]
minidlna.c:496: warn: Unable to change pidfile /minidlna/minidlna.pid ownership: Operation not permitted
minidlna.c:1065: error: Unable to set db_path [/minidlna/cache] ownership to 33: Operation not permitted
minidlna.c:1074: fatal: Failed to switch to uid '33'. [Operation not permitted] EXITING.

So I wonder whether changing the UID of the user running MiniDLNA in the container is actually the right approach. Do you have any suggestions how to gain access to the files, without changing the permissions on the host, because that will mess up the Nextcloud installation.

Here is the Docker Compose snippet I use
version: "3"

services:
  minidlna:
    image: vladgh/minidlna
    container_name: vladgh_minidlna
    restart: unless-stopped
    network_mode: "host"
    volumes:
      - nextbox-compose_nextcloud:/nextcloud
    environment:
      - MINIDLNA_MEDIA_DIR=/nextcloud/data/me/files
      - MINIDLNA_FRIENDLY_NAME=NextboxDLNA
   [  - MINIDLNA_USER=33 ]

volumes:
  nextbox-compose_nextcloud:
    external: true
@vladgh
Copy link
Owner

vladgh commented Nov 13, 2021

This is very interesting. I am not sure how to resolve this, but can you try a few things?
First, it's not MINIDLNA_USER that you need to change but, PUID=33 and PGID=33, like this:

environment:
      - MINIDLNA_MEDIA_DIR=/nextcloud/data/me/files
      - MINIDLNA_FRIENDLY_NAME=NextboxDLNA
      - PUID=33
      - PGID=33

If that doesn't work, maybe changing it to 0 would (PUID=0 and PGID=0)

Another thing I could think of is to chmod -R 755 /nextcloud/data/me/files which would make all media files readable.

Let me know if any of that works!

@vladgh vladgh added the question Further information is requested label Nov 13, 2021
@mcnesium
Copy link
Author

PUID=33 and PGID=33 nailed it. Thank you very much! My parents are happy now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants