With upstart, I used to have the permissions of some files set at boot time via a shell script in /etc/init.d/
(sym-linked, from /etc/rc2.d/
):
link="/sys/class/backlight/intel_backlight"
chgrp backlight "$link/brightness"
chgrp backlight "$link/bl_power"
chmod 664 "$link/brightness"
chmod 664 "$link/bl_power"
But since Ubuntu 15.04, with systemd, I don't know how to do that.
Using systemd, which file(s) can be used to execute commands with root privileges at boot time ?
Thank you
Thanks to JdeBP, I found a way to have the permissions set for files that are generated at each boot. It uses tmpfiles.d, a component of systemd:
I created a file named backlight.conf
(the .conf
matters) in /etc/tmpfiles.d
, containing these lines:
# Type Path Mode UID GID Age Argument
f /sys/class/backlight/intel_backlight/brightness 0664 root backlight -
f /sys/class/backlight/intel_backlight/bl_power 0664 root backlight -
Now, the two files .../brightness
and .../bl_power
have the right groupship, and the right writing rights.
(This solves my problem, but doesn't answer my question)
systemd-backlight
andtmpfiles.d
not achieve it for you? – JdeBP May 14 '15 at 11:32upstart
can't be used. – loxaxs May 14 '15 at 20:20