Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-07-22
6
Medium Priority
?
315 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 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

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

670 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