How to get back sudo on Ubuntu?

Since you have hosed the permissions on the only thing that gives you root level access, you will need some help from OUTSIDE the current software environment to fix this.

I suggest that the easiest way is to boot up a LiveCD for your distro, mount your drive, and change the file permissions using the chmod you listed from there.

You could also try booting into single-user mode in order to get a root shell.

Be aware that usually all things in the /usr/ directory should be owned root so you should just be able to do a recursive chown to fix whatever you broke. (Edit: Per @Gilles comments apparently running chown breaks setuid and setgid bits, so you will need to manually compare to an existing system to restore all of those once you fix the ownership again.)

However, very FEW should be 4111. That extra one is a special permissions but that makes it execute as root even when run as a user! Only sudo and a select few commands should have this permission bit set. If you didn't run a chmod to start with you probably don't need to fix this at all, all the permissions should already be correct. Don't run a big chmod operation without knowing what all the permissions are supposed to be.


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.


In Ubuntu recovery mode, enter the following commands..This fixed the isssue for me..

mount -o remount,rw /
mount --all
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo
restart

Hope this will fix your problem.( or somebody else's)

I found this one here in this blog post.