Minidlna doesn't get permission to work in /home

I tried for hours to get minidlna working to access media in my home directory.
I read the info in the ArchWiki that additional steps have to be done to do so.
I followed the steps and did them all but maybe something is missing.
The default config worked fine.

My edits:

[wave@endos ~]$ cat /etc/minidlna.conf

port=8200
 #user=minidlna
user=wave
media_dir=/home/wave/
friendly_name=minidlna
 #db_dir=/var/cache/minidlna
db_dir=/home/wave/.cache/minidlna
 #log_dir=/var/log
log_dir=/home/wave/.local/share/minidlna
[wave@endos ~]$ cat /etc/systemd/system/minidlna.service.d/override.conf
[Service]
User=wave
Group=wave

The error:

[wave@endos ~]$ systemctl status minidlna.service
Ă— minidlna.service - minidlna server
     Loaded: loaded (/usr/lib/systemd/system/minidlna.service; enabled; preset: disabled)
    Drop-In: /etc/systemd/system/minidlna.service.d
             └─override.conf
     Active: failed (Result: exit-code) since Wed 2025-03-19 00:35:34 CET; 4min 9s ago
   Duration: 876ms
 Invocation: 2c4be0e3bdd740bd8c97793cbc64dc67
    Process: 644 ExecStart=/usr/bin/minidlnad -S (code=exited, status=255/EXCEPTION)
   Main PID: 644 (code=exited, status=255/EXCEPTION)
   Mem peak: 27.9M
        CPU: 70ms

Mär 19 00:35:33 endos systemd[1]: Starting minidlna server...
Mär 19 00:35:33 endos systemd[1]: Started minidlna server.
Mär 19 00:35:33 endos minidlnad[644]: [2025/03/19 00:35:33] minidlna.c:669: error: Media directory "/home/wave/" not accessible [Permission denied]
Mär 19 00:35:33 endos minidlnad[644]: [2025/03/19 00:35:33] utils.c:295: warn: make_dir: cannot create directory '/home/wave/'
Mär 19 00:35:33 endos minidlnad[644]: [2025/03/19 00:35:33] minidlna.c:714: fatal: Database path not accessible! [/home/wave/.cache/minidlna]
Mär 19 00:35:34 endos systemd[1]: minidlna.service: Main process exited, code=exited, status=255/EXCEPTION
Mär 19 00:35:34 endos systemd[1]: minidlna.service: Failed with result 'exit-code'.

With sudo minidlnad it all works but of course it should’t run like that.

What does systemctl cat minidlna.service return?

[wave@endos ~]$ systemctl cat minidlna.service
# /usr/lib/systemd/system/minidlna.service
[Unit]
Description=minidlna server
After=network.target

[Service]
Type=exec
DynamicUser=yes
ExecStart=/usr/bin/minidlnad -S
RuntimeDirectory=minidlna
CacheDirectory=minidlna
ProtectSystem=full
ProtectHome=on
PrivateDevices=on
NoNewPrivileges=on

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/minidlna.service.d/override.conf
[Service]
User=wave
Group=wave

damn, is ProtectHome=on the thing ?

Both these need to be disabled I believe.

1 Like

I’ll try that tomorrow (have to sleep now) but thx so far!
I think that’s it…
Much to hustle for dlna accessing /home btw!

1 Like

It is because you are trying to get write access for the logs and db.

It probably would have been easier if you let it access the media in your home read-only while leaving the db and logs outside of home.

2 Likes

Yes, in my case some years ago it was the thing.
My configuration is pretty similar to your one. I have folders unter /home where all the music, videos and pictures are stored. In /etc/minidlna.conf the different media_dir for audio, video and pictures were set.
I do not change the user for the miniDNLA-service, but in my override.conf I have following entries:

[Service]
ProtectHome=read-only

The parameter DynamicUser is set to yes
Hope it helps!

1 Like

ProtectHome=on was the bad guy - I forgot this one.

Changing DynamicUser=yes wasn’t needed in my case and seems to be important if you have to mount different media shares (dynamic).

You’re right and I don’t even know why I did it - maybe because so many forum posts had it like that.
I changed db_dir and log_dir back to standard folder /var/ so you won’t need any write permissions in your home folder.
That’s why you have to set ProtectHome=read-only

OK, that’s interesting - if you don’t even have to set them to your user!?
I will try that…

Ah sorry, my mistake. The user minidlna is in the same group as the owner of the folders in /home :face_with_peeking_eye:
And the folders and all data inside are readable for this group.

yes, I think this has at least to be. you would’t have access if not…
so you still have user=minidlna in your /etc/minidlna.conf so that group permission is active?

Yes, indeed.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.