sudo fails if it cannot resolve the local hostname and no MTA is installed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sudo |
Fix Released
|
Unknown
|
|||
sudo (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Hardy |
Fix Released
|
High
|
Martin Pitt |
Bug Description
On behalf of Adam Williamson [*]
adamw@ubuntu510:~$ sudo scp 192.168.
adamw@ubuntu510:~$ sudo nano /etc/hosts
sudo: unable to lookup ubuntu510 via gethostbyname()
…yeah, sudo, it’s all very clever until someone loses an eye!
I have a bunch of entries in /etc/hosts because of having four local systems plus a bunch of VMware machines etc. So now when I set up a new VMware machine I just copy the /etc/hosts from the real machine over to the VM then edit a couple of lines to match the VM, instead of re-editing it all from scratch. Only, as you can see, this utterly breaks Ubuntu…all I need to do to fix the sudo problem is edit /etc/hosts so 127.0.0.1 is ‘ubuntu510′ (the name of the VM) rather than ‘zen’ (the name of the real machine), but I can’t do it, because sudo doesn’t work…
the only way out of this that I can see is single-user mode or the recovery console. Not too smart! Surely sudo shouldn’t ABSOLUTELY NEED to look up the host it’s running on?
[*] Originally from http://
If you consider that this is relevant and worth discussing, we can add Adam Williamson to the conversation. Otherwise, just mark it as invalid and forget it.
TEST CASE:
- This only works (i. e. fails) on a system where /usr/sbin/sendmail does NOT exist (standard Ubuntu installation)
- open a terminal and do "sudo -i" to get a root shell; do "hostname foo"
- open another terminal, and try "sudo ls". Hardy final will fail with "unable to resolve host foo" and not run the ls.
- upgrade sudo to the hardy-proposed version and attempt the same. sudo should still complain, but run the ls command.
Changed in sudo: | |
assignee: | nobody → pitti |
Changed in sudo: | |
importance: | Low → High |
status: | Confirmed → In Progress |
Changed in sudo: | |
status: | Incomplete → In Progress |
Changed in sudo: | |
milestone: | none → ubuntu-8.04.1 |
Changed in sudo: | |
status: | Unknown → Confirmed |
description: | updated |
Changed in sudo: | |
status: | In Progress → Fix Committed |
milestone: | ubuntu-8.04.1 → intrepid-alpha-1 |
status: | In Progress → Fix Committed |
status: | Fix Committed → In Progress |
Changed in sudo: | |
status: | Confirmed → Fix Released |
Changed in sudo (Ubuntu): | |
assignee: | Martin Pitt (pitti) → nobody |
I don't regard this as a sudo bug; not being able to resolve your own host name will cause you more trouble than just that.
However, I agree that sudo doesn't need to look up the hostname IF the relevant host part in sudoers is "ALL" anyway.