Permissions on Subfolder for MiniDlna

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 24
Operating system: Ubuntu
PHP version : 7.4

The issue you are facing:

Hi, I am using Minidlna on my nextcloud but the service has a problem with the permission of the data folder.

My Nextcloud data is stored on an external HDD mounted under “/nextcloud”. The Minidlna data folder is also on the HDD but under “/nextcloud/minidlna”, which is mounted in the nextcloud config as external storage.

The problem is that the permission of /nextcloud is 770 and owend by www-data. /nextcloud/minidlna is 777. I dont want to change the hole /nextcloud folder to 777.

How can I set up the right permission for the dlna service?

Is this the first time you’ve seen this error? : Yes

Steps to replicate it:

  1. Install MiniDLNA

I think the rights for the Nextcloud folder are normally 755. Please check it.

Nextcloud: /nextcloud
MiniDLNA: /nextcloud/minidlna

Maybe it is useful (or not) to mount MiniDLNA outside of /nextcloud e.g. /MiniDLNA.

And please:
Do not give another user than www-data write access to /nextcloud directories. Please do not set 777 for /nextcloud and also not for minidlna.

Yes, the owner of /nextcloud is www-data.

/nextcloud/minidlna is owned by root at the moment. (Should I change this?)

/nextcloud is my external HDD, so I could move the nextcloud data to a subfolder and then have 2 foldern (NC Data and MiniDLNA data) on the same level.

Why not on the external disk two folders:
/nextcloud → you must change nothing, www-data:www-data with 755
/minidlna → ???

So i do not know the software. Please explain the software. Who must write or must read to this folder? Maybe www-data:www-data with 755 is also correct.

But please do not change the rights of /nextcloud.

In the tutorial I watched, the permissions on /minidlna were 777 (which is not perfect, but the folder is shared across on my whole network anyway).

At the moment I have 770 on the nextcloud data folder (which should be fine too).

Your idea is exactly what I wanted to do. I only have to move the NC data folder.

What do I have to change except “datadirectory” in the config.php ?

But my initial question was more like:

Is it possible to have a subfolder with access permission inside the parent folder without. So lets say:

/nextcloud on 770 and owned by www-data
/nextcloud/minidlna on 777 and owned by ubuntu

→ Can ubuntu access /nextcloud/minidlna ?

Normal is 755, the second 7 in 770 is only useful for groups. Is ubuntu in group www-data? If not that makes no sense. And why not read for all for the last number? Most parts of you Ubuntu are readable from all. You won’t really achieve more safety if you don’t follow the standard specifications. Keep in mind that those who came up with this probably have far more IT knowledge than either of us.

That might be ok but is also no standard. Why not 770?. But it would better if it is also owned from user www-data if possible.

That might be ok but is also no standard. Why not 770?. But it would better if it is also owned from user www-data if possible.

because NC uses “www-data” and minidlna uses its own user “minidlna”

No it isn’t.

How do you know that? The only recomendations I found where 770.

Maybe you can create a group nextmini and add both users to the group and set the group correctly. Also you can set other to 7 so without a new group both user can write. Also you can add minidlna to group www-data or www-data to the group of minidlna.

All possible. But mostly it breaks.

Must Nextcloud write in minidlna? If not you need only 644 (data) and 755 (directory).
Is this set correctly for minidlna (umask)?
Why must Nextcloud write?

Yes because the folder is mounted as external storage in NC.

Oh yes you are right.

This directory must be readable and writable by your HTTP server user.

documentation External Storage / local

I searched again and found this tutorial (sorry german).
Ok found english version.

In this tutorial i think it is so for your setting:

chown -R www-data:www  /path/to/nextcloud/MiniDLNA
chmod 775 /path/to/nextcloud/MiniDLNA

(maybe also in dir and subdirs)

Add user minidlna to group www-data
usermod -a -G www-data minidlna

(also set minidlna to right path and restart service)

German is fine. xD

Thanks for your help