Linux – Fixing Error sudo: /usr/bin/sudo must be owned by uid.

Linux – Fixing Error sudo: /usr/bin/sudo must be owned by uid.Here is another interesting issue I had to solve very recently.  If you have ever used a linux based operating system like Ubuntu, I assume you have had run into problems which happens suddenly, and you have no idea what caused it :)

This is the error I got,

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

Now I’m going to tell you how I got the above error and how I fixed it.

I searched in many forums about this, and I found that there are two reasons for getting this error.

01.     Directory “/usr/bin/sudo“  is not having permission 755.     This happens if you run a command like “sudo chmod –R 777 /usr/” - which will set the permission to 777 for all the directories recursively.

02.    Directory “/usr/bin/sudo“  is not owned by the root user. (In case if you have run a command to change the owner.)

My issue was due to reason 01, and I solved it by following the below steps.

First restart your pc, and press the SHIFT key while Ubuntu is booting.

This will bring you up the boot menu.

Select Advanced Options.

Select your OS version in (recovery mode), and press Enter Key.

Ex : Ubuntu 14.04 (recovery mode)

It will bring you up another  screen. Now select “Drop to root shell prompt” and press Enter.

It will load a command line at the bottom of the screen.

Now run each of the following commands.


mount -o remount,rw /

mount --all

chown root:root /usr/bin/sudo

chmod 4755 /usr/bin/sudo

restart

Now your pc will restart. Once you log in, you will find that you can use the sudo command again :)

Please leave a comment if this worked for you.

83 comments :

  1. Replies
    1. I'm glad to hear that S@C|-|!/\/. Thanks for the feedback! appreciate it.

      Delete
    2. I have been married with my wife for 6 years and recently she broke up with me and it hurt me deeply when she told me to leave her alone and that she does not love me anymore when i was always faithful and honest to her. I tried all the ways to get her back buying her what she wants like i always did and she still left me heart broken and she even has a new boyfriend which destroyed me even more until a friend of mine from high school directed me to Dr Emu. This man changed my life completely. I followed everything he told me to do and my wife came back. I was stunned everything happened exactly like he told me. I had faith in everything he told me and everything was true. You can contact him via email: Emutemple@gmail.com He will help you in anything you need and quick to answer once you contact him through his whats-app number: +2347012841542
      For more destails about Dr Emu you can visit his Website: http://emutemple.website2.me/

      Delete
  2. Is this the same error you are getting? If you follow the above steps correctly, it should solve the issue. But if not, maybe the issue you have is different. Please let me know after you tried it again..thank you for taking time to leave feedback.

    ReplyDelete
  3. It works. Very Good.

    ReplyDelete
    Replies
    1. Thanks for the feedback Anonymous...I'm glad it worked for you..

      Delete
  4. Replies
    1. Hi Rio Oktafianto, Thank you very much for the feedback. I'm glad it helped :)

      Delete
  5. hy guys,

    it didn't work fo me,

    i only change chmod 777 directory /usr/bin/ , then i follow the above steps. untill restart, but still didn't work.

    Any suggestion for me?

    ReplyDelete
    Replies
    1. Did you find the solution? I changed the permission of /usr/bin and now cannot resolve

      Delete
  6. Hi,
    Thanks, worked fine for me.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. I removed this comment as I was doing one silly mistake while following your steps.

      Delete
  8. It worked. Thanks.

    ReplyDelete
  9. Thank you.. It was helpfull.. :)

    ReplyDelete
  10. mine never worked.instead of the pc restarting it brings an error that it failed to disable graphics turbo

    ReplyDelete
    Replies
    1. Hi Herman Musungu, are you sure that this is the same error you've been getting? and have you followed the given codes as it is? It has worked for many. Please see the above comments. I cannot guarantee it to work, but it's really sad to hear that it didn't work for you.

      Delete
  11. I was lost 3 hour to find problem this. Thank you so much.

    ReplyDelete
  12. Worked great. For some reason had to follow ALL the instructions though. Go figure :-)

    ReplyDelete
  13. It really works! Thumbs Up!! I have fixed this issue on my computer and of my friend's too.. by following your steps and it worked like a charm!
    Thanks a lot, one important thing:
    If anyone can't go to the Recovery mode easily just Turn off your computer and then Start it again.
    After getting BIOS loaded (just before the ubuntu logo) press SHIFT Key and then Select "Advance option" then "Recovery Mode" ...

    ReplyDelete
  14. thank you very much buddy it worked for me on Ubuntu 15.10

    ReplyDelete
  15. It's work for me but when I log-in to ubuntu about 1minute it back to login page. I don't know why.

    ReplyDelete
  16. Thank you so much buddy.... it worked for me on Ubuntu 16.04

    ReplyDelete
  17. thank so much, buddy. You save my day.

    ReplyDelete
  18. Worked for me too! :)

    ReplyDelete
  19. Pretty easy to do and worked well. Thank you.

    ReplyDelete
  20. Thank you guy for help, it's work very well.

    ReplyDelete
  21. Thanks a lot for the post! What does each of the commands do?
    ```mount -o remount,rw /

    mount --all

    chown root:root /usr/bin/sudo

    chmod 4755 /usr/bin/sudo

    restart```

    ReplyDelete
    Replies
    1. Hey anon, thanks for asking. It's not doing much of a complicated thing. First it remounts the root (/) with read & write access on to the root of the file system. Then with mount --all, it mounts all of the mount points given in the fstab. After that you simply change the owner of the /usr/bin/sudo back to root and set it's permissions :) restart will take you back to the boot process where you can log in normally. Hope its clear.

      Delete
  22. Thanks man, it worked for me !!!!

    ReplyDelete

  23. Well somehow I got to read lots of articles on your blog. It’s amazing how interesting it is for me to visit you very often.


    Click here : Used Track Excavators

    ReplyDelete
  24. Thank you very much for sharing this info, works on ubuntu 17.0

    ReplyDelete
  25. Merci la solution marche pour moi

    ReplyDelete
  26. This comment has been removed by the author.

    ReplyDelete
  27. I'm using Ubuntu 18.04 and my problem was due to case 2 where I changed permission on /var/lib. You saved my ass. Thanks

    ReplyDelete
  28. It replied:
    mount_apfs: unrecognized option 'remount'
    mount_apfs: [-o options] [-u UID] [-g GID] [-c [-r] | [-C|-F ]] [-s snapshot]

    ReplyDelete
  29. Ora freezer on restart processo?

    ReplyDelete
  30. Thanks. It worked for me. My problem was due to case 1. You saved me from reinstall the whole virtual Ubuntu.

    ReplyDelete
  31. This comment has been removed by the author.

    ReplyDelete
  32. It worked to me. I changed permissions with chmod 4755 and all just turned back and is running well again. I ran that chmod -R 777 you said because there was some installation that needed to overwrite some folders in /usr and it wasn't granted to do that. I couldn't even log in as root user! Thank you so much!

    ReplyDelete
  33. Thank you for your explanation. Above solution worked for me but I have executed one more command because I was not able to access sudo command from terminal.

    chmod 644 /usr/lib/sudo/sudoers.so

    ReplyDelete
  34. Thanks.
    It works for me.

    ReplyDelete
  35. se il comando shift non funziona provate con esc.
    Ha funzionato per me.

    ReplyDelete
  36. mount: only root can use "--options" option

    iam getting this error

    ReplyDelete
  37. It worked. saved my life, thanks!

    ReplyDelete
  38. Will this delete the data on computer ?

    ReplyDelete
  39. Hi, i want to change all files in a specific directory for this i used below command
    sudo find /everglitz.in -type f -exec chmod 664 {} \;
    sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
    But i unable to resolve can u please help me

    ReplyDelete
  40. Funcionou aqui...muito obrigado!!!

    ReplyDelete
  41. Will this work for ubuntu 18.04 ?

    ReplyDelete
  42. It works for me in Ubuntu 16.04, but I don't remember the root password, so I login as root using the info here https://linuxconfig.org/how-to-reset-lost-root-password-on-ubuntu-16-04-xenial-xerus-linux#h5-reboot-system and run the code that's in this post. Thank you.

    ReplyDelete
  43. will this flash data from hard drive?

    ReplyDelete
  44. It works for me. Great !

    ReplyDelete
  45. it worked!! thank youuuu :)

    ReplyDelete
  46. It works! Thank you.
    My distro is linux mint 18.1.
    The difference is replacing restart by reboot :D

    ReplyDelete
  47. I havent run any chmod commands.. But still I am facing the error.. Please help

    ReplyDelete
  48. it still work, thank you so much bruh!!!!!!!!

    ReplyDelete
  49. I can't enter boot setup and i get this error after trying to update grub (so i can get to boot up my windows)
    Any other ways to solve it?

    ReplyDelete
  50. yes this worked perfectly. thank you. someday i will know what im doing... hopefully

    ReplyDelete