sudo:/etc/sudoers 是全世界可写的

sudo:/etc/sudoers 是全世界可写的

我正在使用 Ubuntu 16.04 LTS。在终端中,我位于 htdocs/project 文件夹中,并运行此命令来更改当前文件夹的权限:

asus@asus-X541UJ:~/Bureau/htdocs/project$ sudo chmod -R 777 /

当终端中出现许多文本后,sudo 命令不再起作用。

sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

答案1

你做错了一件事情:你赋予每个人修改根目录及其所有子目录(包括/etc/etc/sudoers*)的权力。

由于这个原因,sudo将拒绝运行。摘自友好的手册:

            To help prevent the editing of unauthorized files, the following restrictions are enforced unless explicitly allowed by the security policy:

             ·  Symbolic links may not be edited (version 1.8.15 and higher).

             ·  Symbolic links along the path to be edited are not followed when the parent directory is writable by the invoking user unless that user is root (version 1.8.16 and higher).

             ·  Files located in a directory that is writable by the invoking user may not be edited unless that user is root (version 1.8.16 and higher).

如果您有root密码,请使用su -成为root并修复权限。

否则,您需要重新启动机器init=/bin/sh,然后重新挂载/文件系统rw读和写),然后再次修复所有这些权限。这确实可能很繁琐且容易出错,但仍然是可能的。

你可以从以下方式root开始:

find / -type d -maxdepth 1 -exec chmod -vc go-w {} \; chmod -vc 440 /etc/sudoers

相关内容