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

寵の児 提交于 2019-12-01 02:08:12

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.

Your sudo binary doesn't have the setuid flag, as it correctly guessed. As root, try:

chmod u+s /usr/bin/sudo

OSX users:

To everyone landing here from search engines: this is not the way to fix the OSX system that you broke. The question is Linux oriented - hint, lxc tag - and that is what this answer is for. The answer provided by Gustavo Matias might help :-)

@cnicutar has provided the answer

On a Ubuntu 14.04 host, the following worked

    Exit the container
    Stop the container

Now that you are on the host, set the flag

sudo chmod u+s /var/lib/lxc/<container_name>/rootfs/usr/bin/sudo

Check the flag

sudo ls -l /var/lib/lxc/<container_name>/rootfs/usr/bin/sudo
-rwsr-xr-x 1 root root ... ... var/lib/lxc/<container_name>/rootfs/usr/bin/sudo

Start your container and enter the console You should be able to execute

sudo apt-get install <package>

This error can also be caused by the use of jailed ssh shell for the user. Try un-restricting the shell session if this is the case.

I had this proplem today,and I solved this by run following command with root

chmod u+s /usr/bin/sudo

I hope it will help you !

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!