Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whether I get prompted for a password or not, it hangs between accepting the authentication and executing what I asked for. In other words sudo ls will hang for about 60 seconds.

I'm confused about what might be causing this. This is on Centos 5, and I've looked at selinux and set it both to disabled and enabled, but it doesn't seem to have any effect.

share|improve this question
up vote 8 down vote accepted

From @TheAndruu's answer to this question:

This happens if you change the hostname during the install process. To solve the problem, edit the file /etc/hosts localhost localhost.localdomain localhost4 localhost4.localdomain4 [ADD_YOURS_HERE] 
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 [ADD_YOURS_HERE]

I had exactly the same problem on Fedora 11 and this solved it.

share|improve this answer
I just made sure that my $HOSTNAME was set in the line. It worked. Thanks. – dlamblin Sep 15 '09 at 0:59

Sometimes when your default route isn't set, commands like sudo hang.

Try netstat -r to check if the route is set correctly.

Does this machine get its passwords from the local /etc/passwd file or something like ldap?

share|improve this answer
It is not using ldap; I think it is using /etc/passwd – dlamblin Sep 15 '09 at 0:47
/etc/passwd isn't used for auth, it's used for id to name resolution. /etc/shadow is used for authentication. – LiraNuna Sep 15 '09 at 2:09

The only other thing you may want to check is your /etc/resolv.conf file to make sure you have a proper dns entry in there. I have seen in the past where this can cause delay.

share|improve this answer

You should check three things. 1. /etc/hostname 2. /etc/hosts 3. /etc/resolv.conf

I found that my hostname was correct that the hosts file was incorrect and on top of that the resolv.conf needed updating.

share|improve this answer

For me it was krb5-user/config being installed. I noticed this by examining /var/log/auth.log and seeing pam_krb5 attempts before pam_unix. Using apt-get remove to uninstall those packages fixed it. Don't remove those packages if you are on a computer requiring kerberos (pam_krb5) obviously. My sudo hang went from a consistent 30s to 0s.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.