kshetline
Posts: 27
Joined: Thu Jun 07, 2018 3:17 am

Is "sudo systemctl enable myService" necessary to run a service with root privileges?

Tue Feb 25, 2020 5:34 pm

I've just converted a service that had been using WiringPi to use pigpio instead. Since pigpio requires elevated permissions (which WiringPi did not), I needed to make sure that my service (a Node.js web server, set up in /etc/init.d/myService) runs with root privileges.

"sudo systemctl enable myService" seems to do the trick, but I'm not sure if that's the right way to do this -- it doesn't make too much sense to me, since my service previously appeared to be enabled anyway. This is just something I stumbled upon that works. I'm feeling like maybe this is accidentally getting the job done, but it's not the correct approach.

Most of what I've googled about running a service as root seems to be about totally different service set-ups than what I'm using.

Previously "sudo update-rc.d myService defaults" was enough when I didn't need root privileges.

The full project code for the service set-up is documented here: https://github.com/kshetline/aw-clock/t ... y_pi_setup

And here: https://github.com/kshetline/aw-clock/b ... /README.md

Return to “Advanced users”