A combination of DynamicUser, SupplementaryGroups, an StateDirectory
allows it to have close to the minimum necessary privilege.
-# systemd unit file for clunk(8)
+# Example systemd unit file for clunk(8) on Raspbian
[Unit]
Description=pulse clock driver (clunk)
Documentation=man:clunk(8)
[Service]
-ExecStart=clunk -f /var/lib/clunk.state -C pinctrl-bcm2835 -L 17
+DynamicUser=true
+SupplementaryGroups=gpio
+StateDirectory=clunk
+ExecStart=clunk -f /var/lib/clunk/clunk.state -C pinctrl-bcm2835 -L 17
[Install]
WantedBy=multi-user.target