Web lists-archives.com

Re: Running lighttpd as different user: /run/lighttpd still gets created with www-data user and group

On 2018-12-22 15:10 +0100, Manuel Wagesreither wrote:

> I'm running an minbase installation of Debian Stretch and have
> configured lighttpd to run as a different, non-www-data user. However,
> when booting, lighttpd does not start successfully, as /run/lighttpd
> is still owned by www-data. Only when I'm chowning it to the different
> user, lighttpd can be started successfully.
> The system is booting from a readonly image. /run does exist there, but it not populated with a lighttpd directory.
> The readonly image gets created using debootstrap. After
> debootstrapping, a few shell scripts run which change lighttpd to run
> as a different user.
> In detail, the shell scripts are
> * replacing occurences of www-data by the new username in /etc/lighttpd/lighttpd.conf and /etc/init.d/lighttpd, and
> * chownign the webroot, /var/log/lighttpd, /var/cache/lighttpd/compress, /var/cache/lighttpd/uploads
> At which point does /run/lighttpd get created,

If you use systemd as init, the directory is created early by
systemd-tmpfiles(8) as part of sysinit.target.

> and how can I control the owning user and group of this directory?

Copy /usr/lib/tmpfiles.d/lighttpd.tmpfile.conf to /etc/tmpfiles.d and
replace the user and group there.  See tmpfiles.d(5).