How to diagnose “sudo: must be setuid root” or “sudo: effective uid is not 0, is sudo installed setuid root?” error?

Environment setup:

  • Centos 7 | WHM/Cpanel installed | A user who can access Shell and is in the wheel group (sudoer)

This error occurs when trying to use a sudoer user. Users who are in the /etc/sudoers file should be able to run root commands by prefacing sudo to such commands. Here, however, when you supply the sudo command for such a user, the error is shown.

To resolve it, do the following:

1. Run the following commands to check the permissions and ownership of /usr/bin/sudo file. The expected output of the commands is also displayed below.

-l /usr/bin/sudo

1 root root 143184 Apr 11 07:30 /usr/bin/sudo



(4111/---s--x--x) Uid: (0/ root) Gid:(0/ root)


2. If the output is not as displayed above, run the following commands to set the right permissions and ownerships.

[[email protected]]# chown root:root /usr/bin

[[email protected]]# chmod u+s /usr/bin/sudo

3. Lastly, login to WHM>>Account Functions>> Manage Shell Access. Set the particular account to Normal Shell instead Jail Shell as Jail Shell has some restrictions.

Was this article helpful?

Related Articles

Leave A Comment?