[sudo-users] "user is not allowed to run sudo on localhost."

Bob Proulx bob at proulx.com
Tue Feb 8 10:36:25 EST 2005

Philippe Froidevaux wrote:
> > What is the hostname of these hosts?
> mars, jupiter, saturne,... why ? :)

Because if the hostname of the hostname was not set on those machines
then it would explain why the sudo program was matching localhost
rather than some normal hostname.

The code in sudo does this:

    nohostname = gethostname(thost, sizeof(thost));
    if (nohostname)
        user_host = user_shost = "localhost";
    else  ...

Therefore if your hostname was not actually set to anything then sudo
would fall back to thinking the hostname was localhost.  But if you
say the machines do have a hostname then I don't see how the program
could be getting any other answer.

What is in /etc/hosts?  /etc/nsswitch.conf?  What I am looking for is
some way that sudo would determine the hostname differently.  The code
also does a gethostbyname() on the hostname.  Check the DNS records
for those hosts.

> I also try with the fully qualified hostname (host.domain.com) with
> the same result.
> maybe it's a Debian/Sarge related problem, I will try to search around this.

I use sudo on Debian routinely with no issues.  I have machines with
all of Woody, Sarge and Sid running fine.  It still sounds to me like
something in the local configuration is unique on those machines that
are behaving differently than expected.


More information about the sudo-users mailing list