Minidlna `Permission denied`. How to setup properly?

I’ve installed minidlna from repository. My configuration is like this

port=8200
#network_interface=eth0
user=minidlna
media_dir=/opt/minidlna-share
#merge_media_dirs=no
friendly_name=DLNA
#db_dir=/var/cache/minidlna
#log_dir=/var/log
#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt
.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
inotify=yes
enable_tivo=no
tivo_discovery=bonjour
strict_dlna=no
#presentation_url=http://www.mylan/index.php
notify_interval=300
serial=12345678
model_number=1
#minissdpdsocket=/var/run/minissdpd.sock
#root_container=.
#force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title
#max_connections=50
#wide_links=no
#enable_subtitles=yes

This works fine. But when I insert another media directory for example media_dir=home/user/Public, and the sudo systemctl restart minidlna.service it says as follows:

[2021/01/20 21:57:40] minidlna.c:670: error: Media directory "/home/user/Public" not accessible [Permission denied]

I’ve tried changing my user:group for ~/Public folder to root:root but output was the same.

Another thing to be added that the configuration has an option wide_links=no. If I change this to wide_links=yes I should be able to view the linked files also (as mentioned inside config file). But unfortunately that didn’t work either.

Is there any solution?

First of all, that’s a very bad idea for anything in your ~/ folder. Permissions should be set to user:user where user is your username, 'course.

Second, the user variable in your config file needs to match. Set it to your username.

Another option is to set the user to nobody so that way you don’t need to login and any device can access the share.

There is a how to here:
https://wiki.archlinux.org/index.php/ReadyMedia

I recently set it up myself. First edit the config and make sure the directories exist

user=your user name
media_dir=/home/$USER/dir
db_dir=/home/$USER/.config/minidlna/cache
log_dir=/home/$USER/.config/minidlna

Create the file /etc/systemd/system/minidlna.service.d/override.conf with the contents (include your own user and group name):

[Service]
ProtectHome=read-only
User=user
Group=group

I also had to create the directory /run/minidlna and change its ownership to my own user.

1 Like

You mean I mostly got it without knowing a single thing about the software? :grinning_face_with_smiling_eyes:

1 Like