Create user with having only permission to star/stop service
Hi,
I want to create a user who can only start/stop/restart specific service. can anyone guide me in that how it can be done? or a user which can connect over ssh and start/stop/restart specific service. |
Yes, you can do that using "sudo" which is configured in the file /etc/sudoers. Which distro do you have and how do you start, stop, or restart a service normally?
If you use the "service" utility, it could go like this: Code:
%dushyantg ALL=(ALL:ALL) /usr/sbin/service apache2 stop, \ Be sure to a) use "visudo" for editing /etc/sudoers and b) save but not close /etc/sudoers until you have verified that everything works. |
Quote:
why do I see that got a use visudo to edit sudoers file? I use nano whenever I edit sudoers file and have had no ill effects as a result of it, so why do I read and even see you stating that got a use visudo to edit said file? |
man visudo tells what are the advantages of visudo over regular editor.
|
Quote:
If you use "nano" be sure to fire it up with the -w option or even add nowrap to .nanorc so it is done automatically. Some distros will ask you the first time you fire up "visudo" if you want to use "nano" for the editor and set it as the default. Otherwise, you can be sure that the $EDITOR environment variable is set to "nano" and "visudo" will use it then. |
Quote:
thanks for your time... |
I am using CentOS 7 and only want to do it for 2 services.
|
Quote:
|
All times are GMT -5. The time now is 02:24 PM. |