To allow user to run some commands which need root/sudo permission we need to add them in /etc/sudoers file.
I will show an example to give permission to start/stop/restart httpd (Apache web-server).
Open /etc/sudoers file with sudo/root permission using any text editor (Eg: vim) and following line at end of the file:
userabc ALL=/etc/init.d/httpd restart,/etc/init.d/httpd start,/etc/init.d/httpd stop
In above line userabc is the user name for which we are giving permission tor start/stop/restart httpd (Apache web-server).
Now save and exit from /etc/sudoers file.
To test above command login into userabc, and run any of the following command, it will ask for sudo password. We need to enter userabc password for as sudo password that will run the command.
$ sudo /etc/init.d/httpd restart $ sudo /etc/init.d/httpd start $ sudo /etc/init.d/httpd stop
Similarly you can add other command as per your requirement.