Centos Error - Sudo: Effective Uid Is Not 0, Is Sudo Installed Setuid Root

CentOS error - sudo: effective uid is not 0, is sudo installed setuid root?

The problem is that you probably changed permissions to the directory /usr/bin.

To resolve that :

1) First be sure that root is owner of this directory /usr/bin :

chown root:root /usr/bin

2) and change permission for this directory :

chmod u+s /usr/bin/sudo

sudo: effective uid is not 0, is sudo installed setuid root?

I just had this same exact problem on Mac OS after strangely deciding to screw my own system by doing: sudo chmod -R /usr/bin. If that's someone else's case just open Disk Utility, select your OS disk ("Macintosh HD" in my case), go to First Aid tab then hit Repair Disk Permissions, wait a few and things should get fixed.

sudo: effective uid is not 0, is sudo installed setuid root? (on mac os x 10.12)

If you run ls -la /usr, the result most likely will be something like below:

total 0
drwxr-xr-x@ 11 root wheel 374 Oct 14 14:35 .
drwxr-xr-x 32 root wheel 1156 Oct 26 09:49 ..
drwxr-xr-x 19 root wheel 646 Oct 10 18:51 local
... (some other files and directories)

Now it's obvious from the above that unless you are logged in as a root or your user is in the wheel group (which is most likely not), any command you issue with your user which needs write permission (such as brew update) will fail.

One of the possible solutions (and I am not claiming is the best one) would be to change permissions of /usr/local.

Like so:

sudo chown -R $(whoami) /usr/local

Interestingly enough, if you then run

brew update

all goes well and you get the following message:

=> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
sudo chown root:wheel /usr/local

Which I guess explains what happened in the first place.

Hope that helps.

Getting message sudo: must be setuid root, but sudo IS already owned by root

You have to be able to log in as root, but if you can you can run this

chmod u+s /usr/bin/sudo

And fix the problem

Cannot strace sudo; reports that effective uid is nonzero

For security reasons, the setuid bit and ptrace (used to run binaries under a debugger) cannot both be honored at the same time. Failure to enforce this restriction in the past led to CVE-2001-1384.

Consequently, any operating system designed with an eye to security will either stop honoring ptrace on exec of a setuid binary, or fail to honor the setuid bit when ptrace is in use.

On Linux, consider using Sysdig instead -- which, being able to only view but not modify behavior, does not run the same risks.



Related Topics



Leave a reply



Submit