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

I found another question with the same title, however, I suppose my case is a little different.

In an attempt to set up a new project, I needed to install nodejs. I realized that it only worked when used with sudo. E.g. sudo npm

In addition, I visited the link https://docs.npmjs.com/getting-started/fixing-npm-permissions and executed

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

to change the default directory permissions. Now, because I also had npm here, I ran

sudo chown -R $(whoami) $(sudo npm config get prefix)/{lib/node_modules,bin,share}

Send this, whenever I try to use sudo, I get this error -

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

I understand that my setup for npm should be better without root, but I'm a Linux beginner.

Any help would be greatly appreciated. :)

Additional Information -

ls -l $(which sudo) gives => ---s--x--x. 1 dev root 123832 Aug 13 2015 /usr/bin/sudo ---s--x--x. 1 dev root 123832 Aug 13 2015 /usr/bin/sudo

+6
source share
3 answers

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

To solve this problem:

1) First, make sure root is the owner of this directory /usr/bin :

 chown root:root /usr/bin 

2) and change the permission for this directory:

 chmod u+s /usr/bin/sudo 
+6
source

If someone is still having problems with sudo, I was able to solve it by checking access to the account shell in WHM. I got the same error because the account had Jailed Shell restrictions. I installed it in a regular shell, and the error disappeared.

+1
source

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

Noticed: --- s - x - x. 1 dev root 123832 Aug 13, 2015 / usr / bin / sudo

the user and group must be root, and the sudo file must have setuid

Must be --- c - x - x. 1 root root 123832 Aug 13, 2015 / usr / bin / sudo

as well as double

0
source

All Articles