0

I want to restart a linux service from a shell CGI script, which obviously requires root rights. I'm kind of out of options that I know of:

What are the best practices of doing something like that?

torvin
  • 6,515
  • 1
  • 37
  • 52

1 Answers1

1

Another option is to use a sudoer . As a best practice always provide the apache user as little rights as it needs.

Edit the sudoers file with sudo visudo and add a line

apache        ALL = NOPASSWD: /usr/sbin/service /usr/local/myapp * 
Dextro67
  • 195
  • 9