This a template for simple sysmtemd service to change the ownership of a file, since in my case the file is in /sys and it is generated on boot, so using acl didn’t help me. I had to use this hack to change the ownership of a file on each boot.
What I need is a write permissions to a file in order to change the brightness on my laptop with i3wm.
The file is /etc/systemd/system/brightness.service
but there is symlink from the /etc/systemd/system/multi-user.target.wants directory.
This are the contents of the service file:
[Unit] Description=Alter permissionsfor brightness [Service] ExecStart=/bin/chmod go+rw /sys/class/backlight/intel_backlight/brightness ExecStop=/bin/chmod go+rw /sys/class/backlight/intel_backlight/brightness [Install] WantedBy=multi-user.target
You will also want to enable and start the service with:
systemctl enable brightness.service systemctl start brightness.service
All of this action is happening on Ubuntu 18.04