Gaberd
By:
Gaberd

How can I solve this error : sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

October 19, 2017 215 views
DigitalOcean Linux Commands Nginx Ubuntu 16.04

Hello,

I did a stupid thing, on my Ubuntu 16.04 Droplet, I gave a chmod -R 777 * command on /usr folder.
I wanted to restart my Nginx server, but it gave me an error (of course) :

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

And I can not access sudo su - root.

How can I reverse all that?

Thanks you for your answers.

2 Answers

You can chmod u+s /usr/bin/sudo
Though you'll need to actually log as root, if you can't sudo right now.

I don't know of any way of automatically restoring all the permissions on the rest of the files.

Thank you lampreyOne,

I do not know if your solution works, but I found an article here:

http://bitmapcake.blogspot.sk/2014/08/linux-fixing-error-sudo-usr-bin-sudo-must-be-owned-by-uid.html

and it worked for me. Thank you.

Have another answer? Share your knowledge.