简体   繁体   English

CentOS错误-sudo:有效uid不为0,sudo是否安装了setuid root?

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

I found another question with the same headline, however, I suppose my case is a bit different. 我发现了另一个标题相同的问题,但是我想我的案子有些不同。

In an attempt to setup the new project, I needed to install nodejs. 为了尝试设置新项目,我需要安装nodejs。 I realised that it worked only when used with sudo. 我意识到它仅在与sudo一起使用时才有效。 For eg. 例如。 sudo npm 须藤npm

Furthermore, I visited the link https://docs.npmjs.com/getting-started/fixing-npm-permissions and performed 此外,我访问了链接https://docs.npmjs.com/getting-started/fixing-npm-permissions并执行了

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

to change default directory permissions. 更改默认目录权限。 Now because I had to sudo npm here as well, I ran 现在因为我也不得不在这里sudo npm

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

Post this, whenever I try to use sudo, I get this error - 发布此消息,每当我尝试使用sudo时,都会出现此错误-

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

I understand that my setup for npm should have been better and off root, but I am a Linux novice. 我了解我为npm进行的安装应该更好并且没有任何基础,但是我是Linux新手。

Any help would be appreciated. 任何帮助,将不胜感激。 :) :)

More information - 更多信息 -

ls -l $(which sudo) gives => ---s--x--x. 1 dev root 123832 Aug 13 2015 /usr/bin/sudo ls -l $(which sudo)给出=> ---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

The problem is that you probably changed permissions to the directory /usr/bin . 问题是您可能更改了对目录/usr/bin权限。

To resolve that : 要解决这个问题:

1) First be sure that root is owner of this directory /usr/bin : 1)首先确保root是该目录/usr/bin所有者:

chown root:root /usr/bin

2) and change permission for this directory : 2)并更改此目录的权限:

chmod u+s /usr/bin/sudo

If anyone is still experiencing problems with sudo, I was able t solve it by checking the shell access of the account in WHM. 如果仍然有人在使用sudo遇到问题,我无法通过检查WHM中帐户的外壳访问来解决。 I received the same error because the account had Jailed Shell restrictions. 我收到了相同的错误消息,因为该帐户具有“入狱的Shell”限制。 I set it to normal shell and the error was gone. 我将其设置为普通外壳,错误消失了。

Issue: sudo: effective uid is not 0, is sudo installed setuid root? 问题:sudo:有效uid不为0,sudo是否已安装setuid root?

Noticed: ---s--x--x. 注意:--- s--x--x。 1 dev root 123832 Aug 13 2015 /usr/bin/sudo 1 dev根123832 2015年8月13日/ usr / bin / sudo

user and group should be root and the sudo file should have setuid 用户和组应为root用户,并且sudo文件应具有setuid

Should be ---s--x--x. 应该是--- s--x--x。 1 root root 123832 Aug 13 2015 /usr/bin/sudo 1 root root 123832 2015年8月13日/ usr / bin / sudo

and also double 还要加倍

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM