sudo bash /usr/bin/sudo 必须由 uid 0 拥有,并且设置了 setuid 位

sudo bash /usr/bin/sudo 必须由 uid 0 拥有,并且设置了 setuid 位

首先我知道有一个类似的问题这里

当我执行:

sudo bash 

我收到以下错误:

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

但是,我的问题有一个不同之处,不允许我使用如下提出的解决方案来解决它:

1. Log out as the current user, then log back in as root.
2. Execute chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
3. Log out as root, then log back in as the current user. 

因为我无法以root身份登录。

我的问题是如何以 root 身份登录以执行第一步?
1. Log out as the current user, then log back in as root.

答案1

你可以从 USB 拇指驱动器启动,挂载根文件系统,然后chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo。重启后,sudo 应该可以再次工作。

答案2

  1. 退出当前用户身份,然后重新以 root 身份登录。
  2. 执行 apt-get remove sudo -y && apt-get install sudo -y
  3. 以 root 身份注销,然后以当前用户身份重新登录。

此操作将重置所有权限至默认状态

相关内容