My service on CentOS is configured to run under a certain user in its
config file under
When I am
sued as buildman, I can run:
systemctl status myservice.service
but if I try to do
stop, it prompts me for password.
If I do:
sudo systemctl status myservice.service
it does not prompt me because I have configured
%buildman ALL= NOPASSWD: /bin/systemctl * myservice.service
But why doesn't service stop and start work like status? I would like to enable buildman to execute these service commands without sudo or password.
The primary reason for this is that I need to enable service restart from Jenkins and I ran into problems running sudo from its container, which complained that I needed a "TTY" to run it.