Tips & How-To's

[How To] Solution for sudo: must be setuid root problem

I had encountered this problem on sudo/gksu not working few months earlier.

Whenever I had to open an application with gksu it did not open at all !  I was wondering what did i do. I dint know whether  i meddled with something or is it any other configuration that created the problem.

If I type sudo in terminal i get “sudo: must be setuid root”

This is how I went about fixing it:-

  1. Open terminal and enter as root i.e. type ‘su’ and then the root password (Please be careful while being the root). Alternatively, you can also use ur OS’s live CD to mount the root partition (the partition where you have installed your OS)
  2. Next, type chmod 4755 /usr/bin/sudo If the command perfectly happens then as far I am able to tell sudo and gksu should work correctly.

If anyone of you are still having problems regarding this issue please post it in comments

21 Comments

  1. It may sound strange:

    I did both this:
    chown root:root /usr/bin/sudo
    and
    chmod 4755 /usr/bin/sudo

    However, it still doesn’t work, as I keep getting the:
    sudo: must be setuid root
    message.

    Uh, and also ‘su’ has problem, as it fails logging in even if the password is correct.

    Thanks in advance.

  2. Hi,
    i have same problem ie sudo: must be setuid root

    when i type
    node2@node2-prudence:~$ su password
    Unknown id: password
    node2@node2-prudence:~$ chmod 4755 /usr/bin/sudo
    chmod: changing permissions of `/usr/bin/sudo’: Operation not permitted
    how to remove it
    Thanks
    Ramakrishnan

  3. imatta@imatta-lex-745:~$ su imatta
    Password:
    imatta@imatta-lex-745:~$ chmod 4755 /usr/bin/sudo
    chmod: changing permissions of `/usr/bin/sudo’: Operation not permitted
    imatta@imatta-lex-745:~$

  4. this sound helpful, but for me it doesnt work, when i type ‘su’then it ask me for password, after that it says authentication failed. and I know my password. is the one i login with in my laptop, any one with the same issue please help, my laptop is not working because of this error

    1. hey brenda,
      u need to unlock your root user, type the following command:

      sudo passwd

      It will open and ask for your user account’s password (not root password). once you give it, it will ask for “Enter new UNIX password” and enter the password u wish to use for root user. Enter the same password in “Re-enter new UNIX password”. after that try typing “su” and entering the new password………..

      hope this helps…….

  5. Hi Ram thank you very much for your response. the main thing that couse the error i have discovered is this error Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2). I realized i dont have mysqld.sock in mysqld folder. how can i create it?

    1. mount through ur live CD….. u must be having one…. or get one….

      once in the live cd mount ur root partition… then run that “chmod 4755 /usr/bin/sudo” and it shud work…… pls let me know wat happened…..

  6. Eish Ram Sorry that I only come back today after a year and months, you probably thought ohh well this Brenda must have been dead hey! it did work after you gave your explanation :-)

    I Guess I was overwhelmed that its working and didnt bother with the feedback of which its wrong!! thanks a lot anyway

  7. This worked like a charm and helped me fix the sudo uid not set to 0 issue.

    Enter the root mode via Ubuntu Recovery

    In the root mode

    mount -o remount /
    mount -a
    chown root:root /usr/bin/
    chmod 4755 /usr/bin/

    This reset the x to s
    -rwsr-xr-x 1 root root 152K Aug 28 00:56 /usr/bin/sudo

    Earlier it was

    -rwxr-xr-x 1 user root 152K Aug 28 00:56 /usr/bin/sudo

Leave a Reply

Your email address will not be published. Required fields are marked *