LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-07-2005, 02:18 PM   #1
gauge73
Member
 
Registered: Jan 2003
Location: Dallas, TX
Distribution: Fedora Core 4
Posts: 420

Rep: Reputation: 30
Service won't start unless run as root user


I've been toying with bind (a DNS server, if you're unaware), and I've pretty much never run it until today. I got a couple of the zone files set up and wanted to test them. I did the following, and was successful:

# service named start
Starting named: [ OK ]

After a few failed DNS lookups, I checked to see if the process was running. It wasn't. I tried starting it again. It claimed success again, but the process was not running. I tried setting it to debug logging and checked the logs... I found no problems.

So, in an act of desparation, I decided to start the service manually by simply issuing the following command:

# /usr/sbin/named

It ran. I did a few DNS lookups, and it was working. I tried to stop the service afterward and got the following output:

# service named stop
Stopping named: [ OK ]

I checked, and it was still running. How strange! So, I started looking in the /etc/rc.d/init.d/named file and snooping. I found that the service was called with the following command:

daemon /usr/sbin/named -u named ${OPTIONS}

I added an echo in there to see what ${OPTIONS} evaluated to, and it was null. So, I checked the man page for named to find out what the -u switch was for. It sets the username. So, I tried starting it manually with named -u named since it had worked before when started manually. I checked, and it was not running. I tried issuing named -u root. It ran fine.

My next thought was that maybe I had a permission issue with the configuration files. Therefore, I changed all the zone files, the log file, and the named.conf file to 777. I get the same problem.

What should I try at this point?
 
Old 05-07-2005, 06:44 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,114

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
It depends on your syslog setup but usually named error messages will go to /var/log/messages. Did you check there for possible problems? Changing all the files to all permissions may not be the best things, since some services will refuse to run with their config files having insecure permissions (not sure if BIND is one of them).

[edited to add]: you are starting named as root correct? BIND needs to start as root and then drop privileges to the user specified in the -u option.
 
Old 05-07-2005, 08:59 PM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Look in /usr/share/doc/packages/bind/
You may need to install the 'bind-doc' package.

In the contribs directory is a script called nanny.pl

Quote:
# $Id: nanny.pl,v 1.8.2.1 2004/03/09 06:10:33 marka Exp $

# A simple nanny to make sure named stays running.
Also use chkconfig to check the named service.

Last edited by jschiwal; 05-07-2005 at 09:03 PM.
 
Old 05-07-2005, 10:37 PM   #4
gauge73
Member
 
Registered: Jan 2003
Location: Dallas, TX
Distribution: Fedora Core 4
Posts: 420

Original Poster
Rep: Reputation: 30
I found the problem. Apparently, I failed in changing the permission to the log file. The issue was that it didn't have permission to open the log file, and that's why I wasn't seeing any signs of the problem. I saw the error in /var/log/messages. Thanks, guys. Seems to be workin' just fine now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do you run as root or user and why? aysiu Linspire/Freespire 7 10-04-2005 02:19 AM
Is it possible to start a service but not as a root user appas Linux - Software 1 10-15-2004 11:26 PM
how do I make sure that the user that is going to run the script is a root user??? nikold01 Linux - General 3 09-10-2004 07:54 AM
Starting a service as non root user? dee3lmo Linux - General 2 07-30-2004 07:37 PM
Startup service run by user other than root? WeNdeL Linux - Newbie 5 03-20-2003 02:57 PM


All times are GMT -5. The time now is 11:53 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration