We don't necessarily know everything that's wrong with your system, but we do know one thing that's wrong:
sudo: must be setuid root
sudo
is the primary mechanism used to perform administrative tasks in an Ubuntu system. Its ownership and/or permissions are broken, so it cannot work.
Fortunately, on a desktop Ubuntu system, there is another mechanism used to perform administrative tasks: PolicyKit. So you can usually fix a broken sudo
using the pkexec
command-line frontend to PolicyKit, without even having to boot into recovery mode or from a live CD/DVD/USB. sudo
having the wrong ownership/permissions is not the most common breakage scenario, but it's fixed just as easily. Just open a Terminal window (Ctrl+Alt+T) and run these commands:
pkexec chown root:root /usr/bin/sudo
pkexec chmod 4755 /usr/bin/sudo
Running those commands should fix the permissions on sudo
.
That might or might not fix the basic problem. You can see if sudo
works now by running a harmless command like sudo ls
. You should update your question and/or comment here to provide information about what errors you see next, if any.
Once you regain full access to your system you should do one of two things:
Look at your .bash_history
to figure out what commands you ran, then update your question so that we can tell you how to undo any other damage that was done. Your system may still be in an insecure or unstable state, even if things seem to be working all right.
Or, do a fresh reinstallation of Ubuntu, if you're not able to do that.
Finally, please note:
In a situation where you are actually not an administrator on your own computer, that can be fixed quite easily. Fixing it does not involve changing the permissions on any files. Changing the permissions on files does not fix this.
If you an break your system the way it seems you have--that is, if you can change the ownership or permissions of /usr/bin/sudo
--then you were definitely already an administrator on your system (unless you booted to recovery mode or from a live CD/DVD/USB to do it). Non-administrators cannot make such changes to an Ubuntu system.
Even when you are an administrator on your system, you may see "access denied" and similar messages when attempting to perform some tasks. This does not generally mean that you are unable to perform them, but rather that you are not using the right technique to perform them. In particular, administrator accounts are still limited--you must use something like sudo
to perform most administrative actions.