Every time I try to execute sudo su - or any other sudo command for this matter my server hangs, sometimes it take 10 mins to respond and sometimes it never does.

I checked /etc/hosts file which was configured correctly. I also checked /etc/resolv.conf file which looked good as well. any suggestions?

I am running redhat 6.9

share|improve this question
    
So,  do you have any way of becoming root? – G-Man Oct 28 '17 at 6:09
    
Yes.. Sometimes it allows me to become root – Ahmed Soliman Oct 28 '17 at 6:10
    
Have you tried running sudo after you’re already root?  Does it still hang then?  If so, you might try running strace (or some similar program) on it. – G-Man Oct 28 '17 at 6:15
1  
When does it hang -- before asking for the password or after? (Also, strace sudo -i or so might be your friend, even if its output is daunting, because you can see what it's trying to do when it hangs.) – Ulrich Schwarz Oct 28 '17 at 6:16
1  
@GAD3R I think that resolved my issue – Ahmed Soliman Oct 28 '17 at 18:00

The problem can reproduced when the hostname is changed , edit your /etc/hosts by adding the output of echo $HOSTNAME after 127.0.0.1:

127.0.0.1  hostname
share|improve this answer
    
I configured it correctly, the issue was fixed but now its back again for no reason. Not sure what the issue is still :( – Ahmed Soliman Oct 28 '17 at 21:29

Your Answer

 
discard

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.