[systemd-devel] LogsDirectory= permissions

Andrea Pappacoda andrea at pappacoda.it
Wed Apr 20 20:18:03 UTC 2022


Hi! I've been playing around with various options documented in 
systemd.exec(5) recently, and I'm having an issue with `LogsDirectory=` 
and its permissions.

In particular, I've tried setting `LogsDirectory=nginx` for 
nginx.service, but it is now unable to write to the logs. This is 
because the nginx service is started as root, and then drops its 
privileges to www-data (as I'm on Debian). systemd can't know this, and 
chowns the /var/log/nginx directory to root:root, making it impossible 
for nginx threads spawned as www-data to write to them. It was 
previously set to www-data:adm

Is it possible to specify the owner and group of the `LogsDirectory` 
(or of any other directory specified by similar options)?

Thanks :)





More information about the systemd-devel mailing list