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

问题

在使用sudo是提示sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set无法进入root权限。

解决方法

在网上各处搜索的结果的整理,记录以下,方便后期查看。

  1. reboot重启并按住Esc键进入启动模式并选择Advanced options选项。
    sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题_第1张图片
  2. 接下来选择recovery mode
    sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题_第2张图片
  3. 接下来选择root选项。
    sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题_第3张图片
  4. 选择root后在下方终端中输入密码,进入root模式终端。sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set问题_第4张图片
  5. 接下来执行以下操作即可
mount -o remount,rw /
mount --all
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo
chmod 644 /usr/lib/sudo/sudoers.so
chown -R root /usr/lib/sudo
  1. 如果重启后输入sudo提示sudo: /etc/sudoers is world writable(如果提示这个能进入root模式就至今输入密码后执行以下命令,如果仍然进不了root模式则需要再次重复1 2 3 4步骤进入root中断执行)则执行以下命令:
pkexec chmod 555 /etc/sudoers
pkexec chmod 555 /etc/sudoers.d/README
  1. 如果出现“sudo: /etc/sudoers.d is world writable”则执行
pkexec chmod 0755 /etc/sudoers.d

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