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.

53 comments :

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

      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 a blog administrator.

    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. 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