Giving permission to a particular user to start/stop a particular service [closed]

StackOverflow https://stackoverflow.com/questions/21283000

  •  01-10-2022
  •  | 
  •  

سؤال

I want to give permission to a normal user to start/stop a particular service only. Then how can i tweak the sudoers file to achieve this?

هل كانت مفيدة؟

المحلول

Add this entry in the sudoers file

username ALL=(ALL) NOPASSWD: /etc/init.d/Servicename *

If you are using php_exec,

apache ALL=(ALL) NOPASSWD: /etc/init.d/servicename *

Apache is the user who runs the webserver. It is www-data in some OS.

Also dont forgot to comment out

#Defaults    requiretty 

in sudoers file.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top