minidlna scan error. Where I'm wrong?

My minidlna.conf
Code:
# specify the user account name or uid to run as
user=dlna
media_dir= /mnt/Media/Multimedia/Film
log_level=database,scanner=debug
My log file minidlna.log
Code:
enzo@Joshua:/var/log/minidlna % tail -20 minidlna.log
[2015/01/31 11:38:59] minidlna.c:1029: warn: Starting MiniDLNA version 1.1.4.
[2015/01/31 11:38:59] minidlna.c:356: warn: Creating new database at /var/db/minidlna/files.db
[2015/01/31 11:38:59] minidlna.c:1077: warn: HTTP listening on port 8200
[2015/01/31 11:38:59] scanner.c:726: info: Scanning /mnt/Media/Multimedia/Film
[2015/01/31 11:38:59] scanner.c:756: warn: Error scanning /mnt/Media/Multimedia/Film
All the files and directories have the same owner:group, enzo:media, and rights, 770 for the directories and 440 for the files.
Code:
enzo@Joshua:/mnt/Media/Multimedia % ll /mnt/Media/
drwxrwx---  12 enzo          media         512 Jan 31 09:58 Multimedia/

enzo@Joshua:/mnt/Media/Multimedia % ll
drwxrwx---  238 enzo  media  8704 Jan 31 11:37 Film/

enzo@Joshua:/mnt/Media/Multimedia % ll Film/
drwxrwx---  238 enzo  media  8704 Jan 31 11:37 A...
drwxrwx---  238 enzo  media  8704 Jan 31 11:37 B...

enzo@Joshua:/mnt/Media/Multimedia % pw groupshow media
media:*:1002:enzo,a300,xbmc,transmission,dlna
If root calls directly minidlnad -u root -f /usr/local/etc/minidlna.conf all is OK; also miniland -u enzo is OK but if I change the directive "user=enzo" in minidlna.conf the daemon runs always as dlna and results the scan error in the log file.
I have to change the script in rc.d to run the daemon as another user.

If I change owner:group in dlna:dlna for the directory /mnt/Media/Multimedia/Film the result doesn't change.

Where I'm wrong?
 
Referring to the provided minidlna.conf(5) man page, it does not mention the "user" option you are using. Are you sure that is a valid option for that file?

As you said, the rc script provided by the net/minidlna port hard codes the dlna user.

Have you checked the ownership of the database directory /var/db/minidlna? I assume it will have to write to it as it is scanning.
 
Referring to the provided minidlna.conf(5) man page, it does not mention the "user" option you are using. Are you sure that is a valid option for that file?

As you said, the rc script provided by the net/minidlna port hard codes the dlna user.

Have you checked the ownership of the database directory /var/db/minidlna? I assume it will have to write to it as it is scanning.

The last man page is for the ver. 1.0.25 and I'm using the 1.1.4_1,1; in the default minidlna.conf

enzo@Joshua:/usr/local/etc % head minidlna.conf.sample
# port for HTTP (descriptions, SOAP, media transfer) traffic
port=8200

# specify the user account name or uid to run as
#user=jmaggard


So I think that i can use every user, like minidlna, nobody, ..., provided the necessary files have the correct rights; in any case the user option seems not to function.

The ownership of the db is the user that run the rescan and always the group wheel.
After the rescan, if I run the daemon as the user root or enzo i haven't any problem but if I run as the user dlna, obviously, in the minidlna.log I can read that daemon cannot access to the db.
Now, if i change the owner of db in dlna:wheel i can't see anything in the log, but the client can't play anything.

I think the problem is that the user dlna cannot access the directory to scan
/mnt/Media/Multimedia/Film, despite being a member of the media and the rights are correct.
I Remember:

enzo@Joshua:/mnt/Media/Multimedia % ll
total 72
drwxrwx--- 238 enzo media 8704 Jan 31 11:37 Film/

enzo@Joshua:/mnt/Media/Multimedia % pw groupshow media
media:*:1002:enzo,a300,xbmc,transmission,dlna
 
In /usr/local/etc/rc.d/minidlna it shows the username for MiniDLNA is set using the variable below. This is what gets used in the -u flag. You shouldn't need to set a user in your minidlna.conf. You can see how it uses "dlna" as the default when the variable is undefined.

Code:
minidlna_uid=${minidlna_uid-"dlna"}
 
In /usr/local/etc/rc.d/minidlna it shows the username for MiniDLNA is set using the variable below. This is what gets used in the -u flag. You shouldn't need to set a user in your minidlna.conf. You can see how it uses "dlna" as the default when the variable is undefined.

Code:
minidlna_uid=${minidlna_uid-"dlna"}

I think the meaning is, if minidlna_uid is defined sets minidlna_uid otherwise set "dlna" as default.
You're right, in fact if I correct the script with:
Code:
minidlna_uid=${minidlna_uid-enzo}
the demon runs as enzo (default) and I haven't any problem.

However, I can also comment the parameter user in /usr/local/etc/minidlna.conf, and so the demon runs as dlna, but my problem is: why "dlna" can't scan my directory?
 
Correct. But you shouldn't change the script. That just means you can set an rc.conf option like this and you don't have to specify it in your minidlna.conf.
Code:
minidlna_uid="enzo"

For the issue at hand, if you are root and do su -m dlna can you browse around your media directories without issue?
 
Yes, I can browse and everything seems ok.

Code:
root@Joshua:~ # su -m dlna
dlna@Joshua:~ % cd /mnt/Media/Multimedia/Film
dlna@Joshua:/mnt/Media/Multimedia/Film % touch hallo
dlna@Joshua:/mnt/Media/Multimedia/Film % ll hallo
-rw-r--r--  1 dlna  media  0 Feb  1 19:28 hallo
 
I installed MiniDLNA and ran this command after starting it.
procstat -s `pgrep minidlna`
Code:
  PID COMM              EUID  RUID SVUID  EGID  RGID SVGID UMASK FLAGS GROUPS     
  981 minidlnad          933   933   933     0     0     0   022 -     0,5

MiniDLNA is still '0' in all the GID fields meaning it never calls setgid(2) to change to the DLNA group. It only does a setuid(2). You'll need to add permissions on other to read everything if you want it to work.

You would have submit a bug to the MiniDLNA people to fix their program if you want do do things as you have set right now. At line 978 here it seems they only do a setuid(2).
https://github.com/1100101/minidlna/blob/master/minidlna.c
 
My guess is this is related to the issue I just discovered. I had the permissions on my media folders set to 777, only cause I was in a rush. Yes I know. :oops: So this weekend I decided to tighten that up. I added users "plex" and "dlna" (and a third user) to the "media" group. I discovered that plex and 3rd user can access the media group no issues when media permissions is set to 770. But "dlna" cannot. Only way is to set permissions to xx7; meaning "dlna" can only access media when "other users" are allowed.

I am hoping to tighten down the permissions even more eventually, to something like 440, but minidlna seems to be preventing that at the moment. I don't like the DLNA service offered with multimedia/plexmediaserver btw.
 
Back
Top