How can I run a service as another user? Even nobody
would be OK but I have installed shadow-adduser
so I can have a git
user and a caddy
user.
Does procd support this? I would really rather avoid docker for something like this.
https://openwrt.org/docs/guide-user/base-system/users doesn't seem to be useful
efahl
2
The usual way on OpenWrt is to run the process in a jail. You can see it in action with dnsmasq, and see how it's done in https://github.com/openwrt/openwrt/blob/main/package/network/services/dnsmasq/files/dnsmasq.init
$ ps | grep dnsm
PID USER VSZ STAT COMMAND
24205 root 2236 S {dnsmasq} /sbin/ujail -t 5 -n dnsmasq -u -l -r /bin/ubus -r /etc/TZ -r /etc/dnsmasq.conf -r /etc/ethers -r /etc/group -r /e
24243 dnsmasq 74976 S /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf.cfg01411c -k -x /var/run/dnsmasq/dnsmasq.cfg01411c.pid