sudo: unable to resolve host <asdf> - why resolve hostname?

Asked by ray

please explain the reason why sudo does a hostname lookup at all. i see no reason for this. there is no sudo option to disable this. i simply don't want a hostname lookup when i want to run a command locally with elevated permissions. so i won't 'fix' this by changing my hostname files, since that does not really reflect the everyday 'usecase' one faces when using mobile devices. i don't want that lookup in sudo at all. where to disable this 'feature'?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu sudo Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
ray (arkibott) said :
#1

well, i could bring up the question why it relies on any other hostname than localhost. who would want that? i never touched the configs. but something is wrong there if my system is waiting 20 seconds for a hostname lookup if i run a sudo command.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

sudo talks to the local host, so needs to be able to resolve the local PC name to 127.0.0.1 so it can use loopback.
Sounds like you have changed your hostname in /etc/hostname but failed to also change it in /etc/hosts

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

LOTS of commands use loopback to talk within the same system, windows and mac does it too. So you cannot avoid name lookups. Its how operating systems work

Can you help with this problem?

Provide an answer of your own, or ask ray for more information if necessary.

To post a message you must log in.