sudo command is not working in ubuntu 14.04

血红的双手。 提交于 2020-06-29 14:12:41

问题


In my machine sudo command is not working and it is giving following message.

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

When I tried

ls -l /usr/bin/sudo it is giving

-rwxr-xr-x 1 'whoami' root 155008 Aug 28 2015 /usr/bin/sudo


回答1:


It looks like, at some point, someone tried to take over ownership of the sudo executable but used single quotes rather than backticks:

chown 'whoami'  /usr/bin/sudo     # The wrong way
chown `whoami`  /usr/bin/sudo     # The right way
chown $(whoami) /usr/bin/sudo     # Another right way

Note that I say "right way" but it's probably not something anyone should be doing anyway.

You're going to have to figure out some other way of getting into the root account (such as booting in single user mode) and changing the ownership and permissions back to what they should be:

chown root /usr/bin/sudo
chmod u+s /usr/bin/sudo

After that, it should be back at the correct:

-rwsr-xr-x 1 root root 155008 Aug 28  2015 /usr/bin/sudo


来源:https://stackoverflow.com/questions/36566972/sudo-command-is-not-working-in-ubuntu-14-04

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