Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux sudo is working slow after changing the hostname

I have changed my hostname in linux mint and after that my sudo works slow I mean how to change the etc/sudoers back again to work properly or there is anything else that I have to change

like image 439
saurabh Avatar asked Mar 07 '14 12:03

saurabh


3 Answers

you probably need to edit /etc/hosts to reflect your new hostname

otherwise it tries to find info about it via DNS (and timeouts, most probably)

look for:

127.0.0.1  localhost  oldname

and change to:

127.0.0.1  localhost  newname

Of course change only the line corresponding to oldname. Above I gave an an example of a machine which isn't connected to the net...

Below I give an example of a machine which have an IP:

127.0.0.1  localhost
a.b.c.d    oldname     <-- just edit that line
like image 91
Olivier Dulac Avatar answered Nov 15 '22 05:11

Olivier Dulac


Problem solved. I describe to help others.

I've had the same problem. All configurations were correct, but login via ssh and sudo were extremely slow.

cat /etc/hostname was correct, but something did not work.

I solved by changing the hostname NOT from the file but by the command

hostname name-of-the-host

In this way the problem has disappeared. Probably using the hostname command are done other operations and the modification is more complete than just modifying the /etc/hostname file manually.

like image 44
barbatrukko Avatar answered Nov 15 '22 06:11

barbatrukko


Slowliness can be caused by not being able to resolve hostnames. This might be because of wrong entries in /etc/hosts or because of wrong settings in /etc/resolv.conf

Verify both so they be correctly configured. After that continue to the sudoers file.

Have you used the old hostname in the sudoers file, then update the sudoers content to reflect the changes.

like image 30
FrankIJ Avatar answered Nov 15 '22 06:11

FrankIJ