Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MiniDLNA log file permission problem

20 views
Skip to first unread message

Lothar Braun

unread,
Feb 17, 2024, 7:50:06 AMFeb 17
to
Hi,

I'm debugging a permission problem with the log files created by minidlna in /var/log/minidlna. I'm trying to use a different username to run minidlna and do not use the default user account minidlna. The problem is that log file /var/log/minidlna/minidlna.log is created with the owner "minidlna" and does not belong to the user that runs minidlna.

I use the following configuration options:

/etc/minidlna.conf
...
user = myuser
...
log_dir=/var/log/minidlna/ # This directory belongs to the user myuser
...

/etc/default/minidlna:
...
USER="myuser"
GROUP="myuser"
...

/usr/lib/systemd/system/minidlna.service
...
[Service]
User=myuser
Group=myuser
....
ExecStart=/usr/sbin/minidlnad -f $CONFIGFILE -P /run/minidlna/minidlna.pid -S $DAEMON_OPTS -u myuser

The systemd module was loaded with systemctl daemon-reload.

When I reboot the system, then the loading of minidlna fails because someone (presumably minidlna) creates the file /var/log/minidlna/minidlna.log with owner "minidlna" and not to the user "myuser". Minidlna therefore fails to load and therefore quits (lsof shows no process using /var/log/minidlna.conf).

When I manually remove this logfile and run "systemctl restart minidlna" a new file /var/log/minidlna.log is created with the owner "myuser" and minidlna is working properly.

So the problem only occurs when the system is rebooted. As systemd seems to work properly when I manually run systemctl start minidlna.service, I'm not sure if minidlna really creates the log file with the wrong username

My questions:

- Is there a way to determine who creates the log file that belongs to the wrong user at boot? (I have no way to trigger this problem other than on boot)
- Is there any configuration option in minidlna that I did not see that I have to change to successfully run minidlna as myuser?

Lothar

Greg Wooledge

unread,
Feb 17, 2024, 9:00:06 AMFeb 17
to
On Sat, Feb 17, 2024 at 01:34:05PM +0100, Lothar Braun wrote:
> I'm debugging a permission problem with the log files created by minidlna in /var/log/minidlna. I'm trying to use a different username to run minidlna and do not use the default user account minidlna. The problem is that log file /var/log/minidlna/minidlna.log is created with the owner "minidlna" and does not belong to the user that runs minidlna.

unicorn:~$ apt-cache search minidlna
minidlna - lightweight DLNA/UPnP-AV server targeted at embedded systems

There's a Debian package with this name. Are you using that?

If so, the Debian package's postinst script probably created the log
directory.

If you need the log directory to be owned by a different user, just
chown it yourself.

Kushal Kumaran

unread,
Feb 17, 2024, 10:30:06 AMFeb 17
to
On Sat, Feb 17 2024 at 01:34:05 PM, Lothar Braun <deb...@lobraun.de> wrote:
> Hi,
>
> I'm debugging a permission problem with the log files created by
> minidlna in /var/log/minidlna. I'm trying to use a different username
> to run minidlna and do not use the default user account minidlna. The
> problem is that log file /var/log/minidlna/minidlna.log is created
> with the owner "minidlna" and does not belong to the user that runs
> minidlna.
>
> I use the following configuration options:
>
> /etc/minidlna.conf
> ...
> user = myuser

Change to /etc/minidlna.conf is not necessary. It only matters if
minidlna is started as root and you want it to drop privileges. With
the systemd unit starting it as myuser already, this will have no
effect.

> ...
> log_dir=/var/log/minidlna/ # This directory belongs to the user myuser
> ...
>
> /etc/default/minidlna:
> ...
> USER="myuser"
> GROUP="myuser"
> ...

Change to /etc/default/minidlna is not necessary. These settings have
no effect if using the systemd unit.

>
> /usr/lib/systemd/system/minidlna.service

Don't modify the file in /usr/lib. Instead, run "systemctl edit
minidlna.service" and put your "User" and "Group" changes there. This
will create an override file in /etc that will be preserved when the
minidlna package is upgraded.

> ...
> [Service]
> User=myuser
> Group=myuser
> ....
> ExecStart=/usr/sbin/minidlnad -f $CONFIGFILE -P /run/minidlna/minidlna.pid -S $DAEMON_OPTS -u myuser
>
> The systemd module was loaded with systemctl daemon-reload.
>
> When I reboot the system, then the loading of minidlna fails because
> someone (presumably minidlna) creates the file
> /var/log/minidlna/minidlna.log with owner "minidlna" and not to the
> user "myuser". Minidlna therefore fails to load and therefore quits
> (lsof shows no process using /var/log/minidlna.conf).
>
> When I manually remove this logfile and run "systemctl restart minidlna" a new file /var/log/minidlna.log is created with the owner "myuser" and minidlna is working properly.
>
> So the problem only occurs when the system is rebooted. As systemd seems to work properly when I manually run systemctl start minidlna.service, I'm not sure if minidlna really creates the log file with the wrong username
>
> My questions:
>
> - Is there a way to determine who creates the log file that belongs to the wrong user at boot? (I have no way to trigger this problem other than on boot)
> - Is there any configuration option in minidlna that I did not see that I have to change to successfully run minidlna as myuser?
>

minidlna installs a logrotate configuration that also refers to a
user/group name. See /etc/logrotate.d/minidlna.

--
regards,
kushal
0 new messages