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.

102 comments :

  1. 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
  2. It works. Very Good.

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

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

      Delete
  4. 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
  5. Hi,
    Thanks, worked fine for me.

    ReplyDelete
  6. 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
  7. It worked. Thanks.

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

    ReplyDelete
  9. 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
  10. I was lost 3 hour to find problem this. Thank you so much.

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

    ReplyDelete
  12. 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
  13. thank you very much buddy it worked for me on Ubuntu 15.10

    ReplyDelete
  14. 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
  15. Thank you so much buddy.... it worked for me on Ubuntu 16.04

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

    ReplyDelete
  17. Worked for me too! :)

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

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

    ReplyDelete
  20. 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
  21. Thanks man, it worked for me !!!!

    ReplyDelete

  22. 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
  23. Thank you very much for sharing this info, works on ubuntu 17.0

    ReplyDelete
  24. Merci la solution marche pour moi

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

    ReplyDelete
  26. 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
  27. It replied:
    mount_apfs: unrecognized option 'remount'
    mount_apfs: [-o options] [-u UID] [-g GID] [-c [-r] | [-C|-F ]] [-s snapshot]

    ReplyDelete
  28. Ora freezer on restart processo?

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

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

    ReplyDelete
  31. 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
  32. 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
  33. Thanks.
    It works for me.

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

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

    iam getting this error

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

    ReplyDelete
  37. Will this delete the data on computer ?

    ReplyDelete
  38. 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
  39. Will this work for ubuntu 18.04 ?

    ReplyDelete
  40. 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
  41. will this flash data from hard drive?

    ReplyDelete
  42. It worked for me...Thanks...

    ReplyDelete
  43. It works for me. Great !

    ReplyDelete
  44. Thank you,it worked

    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. Thank You so Much

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

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

    ReplyDelete
  50. 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
  51. yes this worked perfectly. thank you. someday i will know what im doing... hopefully

    ReplyDelete
  52. Thanks. it worked!

    ReplyDelete
  53. Thank You si mucho. Ir works

    ReplyDelete