[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: MiniDLNA log file permission problem



On Sat, Feb 17 2024 at 01:34:05 PM, Lothar Braun <debian@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


Reply to: