sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题解决方案

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题解决方案

当我们使用sudo su切换权限时提示错误:

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

该错误出现原因:是因为/usr/bin/sudo的权限被修改了,/usr/bin/sudo 的所有者不是 root 用户,并且没有设置 setuid 位。
解决方案如下:
1.如果知道root账户的密码,使用root账户登录系统执行如下命令:

sudo chown root:root /usr/bin/sudo
sudo chmod 4755 /usr/bin/sudo

这将把 /usr/bin/sudo 的所有者更改为 root 用户,并设置 setuid 位。可以登录普通用户再次执行sudo su验证。
2.如果不知道root账户的密码,可以采取以下步骤(亲测有效):
(1)重启系统,出现启动界面按ESC,进入grub菜单页面(如果esc无法进入,可尝试shift)。选择Advanced options for Ubuntu
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题解决方案_第1张图片
(2)选择Advanced options for Ubuntu后,界面如下:
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题解决方案_第2张图片
选择当前使用内核版本的recovery mode模式。
(3)选择root选项
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题解决方案_第3张图片
(4)出现命令行界面
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题解决方案_第4张图片
(5)再次执行如下命令:

sudo chown root:root /usr/bin/sudo
sudo chmod 4755 /usr/bin/sudo

执行完成后,重启系统,再次执行sudo su命令,不在出现sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题。

你可能感兴趣的:(linux,linux,ubuntu)