0

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.

  • Why is the command sudo apt-get update not working.. what is the error? When it asks for password what password do you type in..? You need to use the user's password, not the root password. root account is disabled on Ubuntu. – Fanatique Jun 6 at 13:45
  • i have followed this link as well but not getting any solution askubuntu.com/questions/452860/… – user1046356 Jun 6 at 13:58
  • How did you follow it.. the link says that you must reinstall and you say that you don't want to do that? – Fanatique Jun 6 at 14:06
  • i have used just su command but we dont know password for that , we knows only user password , please let me guide, Thanks – user1046356 Jun 6 at 14:10
  • Not all things Sir , just trying run su Command – user1046356 Jun 6 at 14:10
0

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.

  • And as this comment suggests: " that will fix sudo, but it isn't going to fix the dozens of other things that were broken." – CaldeiraG Jun 6 at 14:29
  • 1
    Yup, exactly. But @CaldeiraG, we do not know yet how OP actually broke their system.. if it is done the same way in that thread, then yeah, this won't fix anything. But chances (although infinitely slim) are that they only broke sudo. – Fanatique Jun 6 at 14:38
  • 1
    That is true. Just want to point out that for future reference! – CaldeiraG Jun 6 at 14:45
0

Searching on internet i found that to solve that technical issue You have to switch to ubuntu recovery mode:

mount -o remount,rw /

mount --all

chown root:root /urs/bin/sudo

chmod 4755 /urs/bin/sudo

restart

This also is useful information:

https://www.digitalocean.com/community/questions/sudo-urs-bin-sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set

  • This is the exact same answer as mine? You don't really need to remount, it's already been mounted. – Fanatique Jun 6 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.