Uh... that's an interesting situation.
sudo requires the binary to be owned by
root and have the
setuid flag on it to function properly (this allows it to execute as the file owner, no matter who actually launched it).
By changing the owner,
sudo can no longer run as
root, and subsequently, can't run your commands as
The easiest method to recover from this is to
- Reboot the machine into single-user-mode
- Copy all your important files off onto a USB or external drive.
- Reinstall Ubuntu, and then restore your files.
As you found out, there are a number of system files which absolutely depend on having the correct owner and the correct permissions.
SSHd for example, will refuse to start if the host private key does not have exactly correct permissions (
0600 and owned by root I think).
sudo cannot elevate itself without being
setuid and owned by
root, and I'm sure there are many other security-related programs that won't operate if they see that things aren't perfect.
Through a lot of very tedious work, it would be possible to recover some of the permissions using an external computer, but it's not a fun task and a reinstall is probably going to be much simpler.