Linux – sudo command is not working on Ubuntu 16.4

linuxsudoUbuntu

I have a linux Ubuntu laptop (16.4) that was not supporting any command starting from sudo and I have googled but not getting any solution because we don't know root user and password, so I am totally stuck.

For Example: If I want to run any command it doesn't work, like:

sudo apt-get update

And I get the error:

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

How can I fix it?

I don't want to format machine right now.

Best Answer

Try to change back the permissions for the sudo binary:

Reboot into rescue/emergency mode

Execute the following command:

chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo

Boot back into normal mode. If that doesn't work and you still have problems with permissions, then you've broken your system and a simple fix for the sudo command won't fix anything - you'll need to reinstall your machine.

Related Question