I have a linux Ubuntu laptop (16.4) that was not supporting any command starting from sudo and I have googled but not getting any solution because we don't know root user and password, so I am totally stuck.
For Example: If I want to run any command it doesn't work, like:
sudo apt-get updateAnd I get the error:
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit setHow can I fix it?
I don't want to format machine right now.
74 Answers
Try to change back the permissions for the sudo binary:
Reboot into rescue/emergency mode
Execute the following command:
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudoBoot back into normal mode. If that doesn't work and you still have problems with permissions, then you've broken your system and a simple fix for the sudo command won't fix anything - you'll need to reinstall your machine.
3Searching on internet i found that to solve that technical issue You have to switch to ubuntu recovery mode:
mount -o remount,rw /
mount --all
chown root:root /urs/bin/sudo
chmod 4755 /urs/bin/sudo
restart
This also is useful information:
1solve sudo error
you should reinstall "sudo" command
for this do fallowing recipe:
1- install "synaptic package manager"
you can download it from :
or
or
search in ubuntu software update app "synaptic package" and install it
image:enter image description here
2- open app
3- on top of page click on search box and text "sudo"
now find the "sudo" in list > and click on solid square & on the opened square select on "mark for reinstallation" > then click on Apply on top of page
and install it
images:enter image description here & enter image description here
4- open terminal and run "sudo" command
you get :
usage: sudo -h | -K | -k | -V usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user] usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command] usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u user] [VAR=value] [-i|-s] [<command>] usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u user] file ...
so : the sudo is working now
enjoy it...
If you still have your password. Try:
suIt will prompt you for your password and make you the root. Do as the command says,
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudoyou should get your sudo back.
1