You are not logged in.

#1 2019-08-20 05:23:22

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

[SOLVED] ReadyMedia (minidlna) Access to Home Directory

I have ReadyMedia/minidlna running and it works great if I want to serve videos from a location like /opt/vids, but if I try to use a home directory, it doesn't seem to have access as the files can't be seen. The Arch Wiki page says this can be fixed by "updating" the systemd unit override file. I didn't have the override file, nor the "minidlna.service.d" higher level directory, so I created them both, ran systemctl daemon-reload, and restarted minidlna (systemctl restart minidlna), but the issue still remains. Does anyone know how to fix this? Thanks.

[root@laptop ~]# more /etc/systemd/system/minidlna.service.d/override.conf
[Service]
ProtectHome=read-only
[root@laptop ~]# more /etc/minidlna.conf | grep media_dir | grep -v "#"
media_dir=/home/tony/myvids

With the exception of updating media_dir and now creating the override.conf file, it is a default minidlna installation.

Last edited by tony5429 (2019-08-21 12:39:31)

Offline

#2 2019-08-20 12:28:37

Omar007
Member
Registered: 2015-04-09
Posts: 368

Re: [SOLVED] ReadyMedia (minidlna) Access to Home Directory

Does the minidlna user have the right to access the files? (facl, owned by or public?)

Offline

#3 2019-08-20 12:45:54

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

Re: [SOLVED] ReadyMedia (minidlna) Access to Home Directory

Hmm.... I'm running minidlna as a system service, having originally enabled the daemon as root (systemctl enable minidlna). Wouldn't that give it access to user files?...

Here's the info for the myvids folder:

[tony@laptop myvids]$ ls -al
total 86196
drwxr-xr-x  2 tony tony     4096 Aug 19 05:36 .
drwx------ 36 tony tony     4096 Aug 19 05:36 ..
-rwxr-xr-x  1 tony tony 59340382 Aug 19 05:36 IMG_20190209_105959778.mp4
-rwxr-xr-x  1 tony tony 28910607 Aug 19 05:36 IMG_20190223_115059046.mp4

Offline

#4 2019-08-20 13:04:37

Omar007
Member
Registered: 2015-04-09
Posts: 368

Re: [SOLVED] ReadyMedia (minidlna) Access to Home Directory

It does not. The fact that it's a system service doesn't mean it runs as root (thank god it doesn't!). ReadyMedia/minidlna runs as the 'minidlna' user and group.

Since the '..' directory is not owned by minidlna, execute permissions are not granted to 'other' nor any ACLs for minidlna have been created, it just can't access the files. There is no way for the minidlna user to traverse to those MP4 files using the permissions you have set.

You'll have to assign the appropriate permissions or, alternatively, run minidlna from your own user instead (set 'user = ...' in /etc/minidlna.conf or https://wiki.archlinux.org/index.php/Re … r_own_user).
Keep in mind that the latter (running as your own user) would reverse the problem if your own user can't access the files in /opt/vids, so this may not be a solution for you.

Last edited by Omar007 (2019-08-20 13:07:15)

Offline

#5 2019-08-20 13:56:11

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

Re: [SOLVED] ReadyMedia (minidlna) Access to Home Directory

OK, I tried switching the user in /etc/minidlna.conf, restarting, and rescanning, but I'm still not seeing any files on the TV...

[root@laptop ~]# more /etc/minidlna.conf | grep user | grep -v "#"
user=tony
[root@laptop ~]# systemctl restart minidlna
[root@laptop ~]# minidlnad -R

Offline

#6 2019-08-20 14:00:05

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

Re: [SOLVED] ReadyMedia (minidlna) Access to Home Directory

Hmm, just noticed that I'm getting a "Permission denied" error now...

[root@laptop ~]# systemctl status minidlna
● minidlna.service - minidlna server
   Loaded: loaded (/usr/lib/systemd/system/minidlna.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/minidlna.service.d
           └─override.conf
   Active: failed (Result: exit-code) since Tue 2019-08-20 06:54:23 MST; 3min 57s ago
  Process: 9953 ExecStart=/usr/bin/minidlnad -S (code=exited, status=255/EXCEPTION)
 Main PID: 9953 (code=exited, status=255/EXCEPTION)

Aug 20 06:54:23 laptop systemd[1]: Started minidlna server.
Aug 20 06:54:23 laptop minidlnad[9953]: [2019/08/20 06:54:23] minidlna.c:620: error: Media directory "/home/tony/myvids" not accessible [Permission denied]
Aug 20 06:54:23 laptop minidlnad[9953]: minidlna.c:433: error: Unable to open pidfile for writing /var/run/minidlna/minidlna.pid: Permission denied
Aug 20 06:54:23 laptop minidlnad[9953]: minidlna.c:1002: fatal: Failed to switch to uid '1000'. [Operation not permitted] EXITING.
Aug 20 06:54:23 laptop systemd[1]: minidlna.service: Main process exited, code=exited, status=255/EXCEPTION
Aug 20 06:54:23 laptop systemd[1]: minidlna.service: Failed with result 'exit-code'.

Offline

#7 2019-08-20 14:09:23

Omar007
Member
Registered: 2015-04-09
Posts: 368

Re: [SOLVED] ReadyMedia (minidlna) Access to Home Directory

Ah yea that won't work with the service. Forgot about that. Iirc this has to do with 'NoNewPrivileges=true'?
(I also noticed that, in addition to this, the service sets the user and group to minidlna. I'm not familiar enough with systemd to say which of those (or both) have influence on the ability to use the minidlna.conf user=... setting)

The easiest way (imo) would be to fix the file permissions or run it as your own user as described on the wiki.
You could override the service further (e.g. set that to 'false') I suppose.. But I would personally just fix the permissions instead. I'd rather have my processes as isolated/controlled as possible and explicitly manage permissions where needed instead.

Last edited by Omar007 (2019-08-20 14:21:23)

Offline

#8 2019-08-21 03:23:59

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

Re: [SOLVED] ReadyMedia (minidlna) Access to Home Directory

Thanks for all your help. I followed the instructions on the wiki page for installing/running as my own user and that solved the problem!

Offline

#9 2019-08-21 03:27:42

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] ReadyMedia (minidlna) Access to Home Directory

Please remember to mark your thread as [Solved] by editing your first post and prepending it to the title.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#10 2019-08-21 12:39:56

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

Re: [SOLVED] ReadyMedia (minidlna) Access to Home Directory

Done; thanks for the reminder.

Offline

Board footer

Powered by FluxBB