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

47,379

Solution 1

The Setuid bit is not set. If it were, the permissions would have an s instead of the first x:

$ ls -l /usr/bin/sudo 
-rwsr-xr-x 1 root root 155008 Feb 11  2014 /usr/bin/sudo

Try using pkexec to set it correctly:

pkexec chmod a=rx,u+ws /usr/bin/sudo

Though I doubt that's the only problem you are going to have.

Solution 2

Login with root (su) and run the following command

chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
Share:
47,379

Related videos on Youtube

Crocodile
Author by

Crocodile

Agile product development enthusiast & business geek, maker 🛠️⚙️🚀 I build fun projects: http://screenshotflow.com, https://onthespotapp.net, s̶e̶c̶r̶e̶t̶f̶u̶t̶u̶r̶e̶p̶r̶o̶j̶e̶c̶t̶s̶ CSPO Product Management, Marketing, Hands on with Android Java/Kotlin, NodeJs, VueJs

Updated on September 18, 2022

Comments

  • Crocodile
    Crocodile almost 2 years

    I am trying to run the following command:

    $ echo "My username is: `whoami`"
    My username is: d
    $ sudo chown -R `whoami` /usr/local/lib/node_modules
    sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
    

    I don't understand what the problem is because root is uid 0:

    $ id -u root
    0
    

    And the setuid seem fine:

    $ ls -l /usr/bin/sudo
    -rwxr-xr-x 1 4755 root 155008 Feb 10  2014 /usr/bin/sudo
    
  • Mark Williams
    Mark Williams over 9 years
    Cool, I didn't know that one - could have saved me grief the other day!
  • Fabby
    Fabby over 9 years
    Oh! Look! I can upvote twice!
  • user2201789
    user2201789 over 2 years
    i got this "pkexec must be setuid root" what should i do?
  • muru
    muru over 2 years
    @user12158726 then you're much worse off and will need to reboot and use recovery shell, or use a live USB, to fix permissions.