-   Linux - General (
-   -   Service won't start unless run as root user (

gauge73 05-07-2005 02:18 PM

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? :(

btmiller 05-07-2005 06:44 PM

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.

jschiwal 05-07-2005 08:59 PM

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

In the contribs directory is a script called


# $Id:,v 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.

gauge73 05-07-2005 10:37 PM

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. :)

All times are GMT -5. The time now is 02:44 AM.