我打破了sudo吗?

露西·曼佐利

所以我输入

sudo chmod 777 -R /usr/bin

现在当我尝试使用 sudo 时,它会说,

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

我尝试使用 chmod 更改 /usr/bin/sudo 的权限,但它说

chmod: changing permissions of '/usr/bin/sudo': Operation not permitted

我该怎么办?我不能使用 sudo 并且我没有足够的权限来更改 sudo 的权限而不使用 sudo。

mt42

如果您不知道 root 密码,su也无法使用。现在你运气不好。但它还没有丢失。

进入已安装的系统并输入:

% df -k /usr
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda5       61386772 5754168  52491280  10% /usr

记住并最好记下这个 /dev/sda5。在你的情况下,这个设备可能会有所不同,因为我有几个分区。

现在启动到 live DVD。

以 root 身份输入终端。

执行如下命令:

# mount /dev/sda5 /mnt

注意:代替 /dev/sda5 键入从上一步记下的设备!!!

现在输入:

# chmod 4755 /mnt/bin/{sudo,chsh,newgrp,passwd,chfn,gpasswd}
# chmod 6755 /mnt/bin/{at,procmail}

事实上,最好的可能就是做

# chmod 4755 /mnt/bin/sudo

其余的您可以在正常启动时在已安装的操作系统中完成,如上所述。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章