On Tue, Nov 18, 2014 at 07:47:59PM +0100, Matthias Urlichs wrote:
> Your specific package may well have different and non-general requirements,
> in which case

> > >>     ExecStart=sudo -u $USER_MINIDLNA -g GROUP_MINIDLNA 
> > >> /usr/sbin/minidlnad -S

> is an adequate and perfectly serviceable answer to your question.

> > init script has the ability to change the user and this is really useful
> > because the multimedia file are likely owned by you and in your home
> > directory by daemon and not minidlna and why should you belong to minidlna
> > group?...

> Maybe because Debian is a multiuser system AIUI, so running the daemon as a
> specific "normal" user didn't even occur to me. Sorry!

> > But again this does not really slpit the script to configurable option that
> > will not be overwritten when upgrading...

> The idea is for the package to ship a /lib/systemd/system/PACKAGE.service
> file which uses a "generic" user+group. You can then add a file
> /etc/systemd/system/PACKAGE.service which merely overwrites user+group
> settings and does not contain any other entries, in which case they'll
> be inherited from the file in /lib. No overwriting on update will happen.

> If you already do have an /etc/default/PACKAGE file, the sudo method's
> advantage is that you can just use an EnvironmentFile= stanza, and thus
> don't need to keep that and /etc/systemd/system/PACKAGE.service in sync
> somehow.

The disadvantage of the sudo method is that you are spawning a PAM session,
which is not desirable for any service.

Preferable would be to parse any existing config file for non-default user
settings as part of the package upgrade and write out
/etc/systemd/system/PACKAGE.service with only these non-default values,
avoiding any variable substitution or sudo invocation entirely.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org

Attachment: signature.asc
Description: Digital signature

Reply via email to