sudo:无法统计 /etc/sudoers:权限被拒绝...... Mint 18.2 Cinnamon

Som*_*lse 4 permissions su sudo linux-mint

我试图更改我认为只是一个目录但结果是“/”的权限,从而搞砸了一些权限问题。现在我遇到了 sudo 问题:在控制台中作为非 root 用户,当我尝试以 root 身份登录时,我得到:

sudo su
sudo: unable to stat /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Run Code Online (Sandbox Code Playgroud)

但是,我可以通过使用 GUI Nemo 文件浏览器获得对目录的 root 终端访问权限,然后右键单击并单击“以 root 身份打开”。大多数其他有类似问题的帖子都有这个问题,因为文件/目录权限不正确,但我认为这不是确切的问题,因为当我这样做ls -ld /etc// ls -l /etc/sudoers我得到:

drwxr-xr-x 157 root root 12288 Dec 15 15:36 /etc/
-rw-r--r-- 1 root root 755 Dec 15 15:36 /etc/sudoers
Run Code Online (Sandbox Code Playgroud)

更新系统似乎也不起作用。

我试过了:

apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall sudo
Run Code Online (Sandbox Code Playgroud)

但这似乎并没有真正做任何富有成效的事情

这是sudoers的内容:

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults    env_reset
Defaults    mail_badpass
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
Run Code Online (Sandbox Code Playgroud)

小智 9

不是sudoers配置文件的问题。您可以使用visudo -c. 如果您针对您的文件运行,您将检查它是否解析正常。仅凭您提供的信息我无法确定问题所在,但您可以尝试以下方法。

  • 确保所有路径/etc/sudoers都是可执行的
  • 确保/目录的权限为 755(drwxr-xr-x)
  • 尝试使用dpkg-reconfigure以 root 身份运行的默认值重新配置包

请提供有关 的新权限的信息/

PS:我觉得奇怪的是你的 sudoers 文件有写权限,记住你应该只用 visudo 编辑 sudoers 文件。

  • 谢谢,这是 / 的一个简单的未命中配置,这成功了:`ors etc # ls -ld / drwx---rx 23 root root 4096 Dec 12 20:09 / ors etc # chmod 755 / ors etc # ls - ld / drwxr-xr-x 23 根根 4096 12 月 12 日 20:09 /` (5认同)