Ubuntu – How to get back sudo on Ubuntu

passwordpermissionsrootsudoUbuntu

I have done this:

sudo chown -R myname /usr/

and now I can't use the sudo command because of this error:

sudo: must be setuid root

And as I read this means that the owner of this file /usr/bin/sudo is not the root. It's my user now because of the chown on the /usr folder.

On many forums and blogs people suggest to do this as root:

# chown root:root /usr/bin/sudo
# chmod 4111 /usr/bin/sudo

…but the problem with this is that I need to log in as a root, but I can't because If I write su in the terminal the password is wrong (actually I use the password what I added to my user):

$ su
Password:
su: Authentication failure

So can I get back the sudo command?

Edit: My Ubuntu is under Paralells on my Mac OS X.

Best Answer

If you have a similar system that you can use as a guide to see what the correct ownership for all of the files is, then you can boot into rescue mode, drop to a root shell, and manually restore the correct ownership to all of the files in /usr.

The quickest way may be to reinstall your OS or restore from backup.

In Ubuntu or similar, then there is no root password by default (the account is disabled), which is why you can't su.

Related Question