Solved

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

Posted on 2006-07-22
6
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 43

Accepted Solution

by:
ravenpl earned 125 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 125 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Fine Tune your automatic Updates for Ubuntu / Debian
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

623 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