Ubuntu无法使用sudo,提示:/usr/bin/sudo must be owned by uid 0 and have the setuid bit set

由于手残,本来只想更改pip文件权限,结果,将整个bin目录的权限更改了。导致无法使用sudo。

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

最坑的是之前没有设置root账号,无法在命令行进入root.

使用su root命令时会报以下错误:

su:Authentication failure

这个时候我们可以用以下方式激活root:

ubuntu命令行->reboot重启->按esc进入->选择Advanced options for Ubuntu->选择recovery mode->选择root命令行模式

因为recovery模式默认是以只读模式挂载,所以我们要重新挂载切换到读写模式:

mount -o remount,rw /
mount --all

然后我们可以赋予sudo的执行权限:

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

然后重启系统:

reboot

到这里问题解决。这件事告诉我们,Ubuntu装上后,赶紧添加root用户。

猜你喜欢

转载自blog.csdn.net/weixin_41735859/article/details/85253496