Linux sudo is working slow after changing the hostname
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
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.