sudo must be owned by uid 0 and have the setuid bit set

38,360

Solution 1

You shouldn’t have a /usr/local/bin/sudo, that’s what’s breaking things (not the password change). Move it out of the way:

/usr/bin/sudo mv /usr/local/bin/sudo{,2}

and then tell your shell about it:

hash -r

That will restore the sudo functionality you’re used to.

Solution 2

I recently experienced this problem because I ran the following command

sudo chmod -R 777 /usr/*

Unfortunately /usr/bin/sudo is not owned by root and breaks as a result.

To fix the problem I booted into recovery mode which provides a scroll down menu with an option to drop down to a root shell.

From the root shell I ran the following commands:

# remount disks in read write mode
mount -o remount,rw /
mount --all

# return ownership
chown root:root /usr/bin/sudo

# fix permissions
chmod 4755 /usr/bin/sudo

reboot

This solved my problems once I logged back in as a user.

Share:
38,360

Related videos on Youtube

Jeff Schaller
Author by

Jeff Schaller

Unix Systems administrator http://www.catb.org/esr/faqs/smart-questions.html http://unix.stackexchange.com/help/how-to-ask http://sscce.org/ http://stackoverflow.com/help/mcve

Updated on September 18, 2022

Comments

  • Jeff Schaller
    Jeff Schaller over 1 year

    I have changed my Ubuntu super password by recovery mode; after that, I can't run my sudo command in normal user .

    I have attempted to crack my previous password in Recovery mode; I followed this link to crack my password.

    $sudo ---In global mode throws me the below error:

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

    $ ls -l sudo gives:

    -r-sr-xr-x 1 root root 136808 May 29  2017 sudo
    

    /usr/local/bin$ ./sudo ---> I need this /usr/local/bin ./sudo isn't working -- it throws the below error:

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

    /usr/bin$ ./sudo --> working fine

    usage: sudo -h | -K | -k | -V
    

    I need to access my sudo command from the terminal from anywhere.