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.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
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.
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.
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.
@albimaan In the first step SHIFT key do not work for dell-Vostro-3491. esc key should be pressed after restart.
First of all we will get an error which will show : “sudo /usr/bin/sudo must be owned by uid 0 and have the setuid bit set aws. This means the sudo root permission has been over written, which creates restriction of using sudo and it leads you into problems like all the root access you lost and getting back from this situation is not a one way solution , so lets take a look and try to back track :
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 .
https://www.youtube.com/channel/UCo-36Ev7P3LuuB856IDRL7Q
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.