Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to start a service without using the root account in linux

Posted on 2006-07-22
6
Medium Priority
?
320 Views
Last Modified: 2013-12-16
Hi Friends

How can i assign a user  to start | stop | restart a service?
I tried one method ... :).

"chown user.user /etc/init.d/nagios".

 But didn't work . . :(

Would you help me out to find an answer.?

Regards

0
Comment
Question by:dinkon4u
6 Comments
 
LVL 43

Accepted Solution

by:
ravenpl earned 500 total points
ID: 17159778
use sudo and configure /etc/sudoers
eg. in /etc/sudoers
username   ALL=/etc/init.d/nagios *

then as username
sudo /etc/init.d/nagios start
0
 
LVL 22

Assisted Solution

by:pjedmond
pjedmond earned 500 total points
ID: 17159782
The problem is that the service needs to initially run as root in many cases. In order to do this, you need you use:

1.    Setuid - Not recommended, unless you trust the individuals that have access to the system 100%:

http://www.samag.com/documents/s=1149/sam0106a/0106a.htm

gives a number of good reasons not to use this approach.

2.   Use sudo - This allows commands to be executed as root based on permissions in the /etc/sudoers file:

http://www.chinalinuxpub.com/doc/www.siliconvalleyccie.com/linux-hn/sudo.htm

Due to the nature of this command if a 'flaw' is found in it, then the implications are potentially serious, so you need to keep an eye on advisories.

(   (()
(`-' _\
 ''  ''
0
 
LVL 3

Expert Comment

by:bryanlloydharris
ID: 17171104
Raven and pj are right, sudo is a good choice.

sudo service nagios start
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17175180
probably you vcan configure your service to use ports > 1023, then their might start it as ordinary user
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question