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.

[root@serv1]# chown root:root /usr/bin

[root@serv1]# 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.

Rate This Article

(9 out of 20 people found this article helpful)

Leave A Comment?