使用“visudo -x”选项后没有 sudo

使用“visudo -x”选项后没有 sudo

visudo警告我有关语法错误,因此我没有进行任何更改就退出了。我决定在其中创建一个新文件/etc/sudoers.d。不幸的是,我没有对 manfile 概要给予足够的重视并发布sudo visudo -x /etc/sudoers.d/jupyter(正确的论点应该-f不是-x)。这导出了我的配置而不是创建新文件,最终结果是不再需要 sudo

  1. 是否可以在不重新启动进入恢复模式的情况下恢复?
  2. 另外,visudo应该这样工作吗? (不是讽刺,但其预期目的是保护用户,对吧?)Debian 联机帮助页指出它至少验证输入和输出文件是否相同。但显然它没有检查出口目的地是否合适?

使用 Debian 8(32 位)

>>> /etc/sudoers.d/jupyter: syntax error near line 1 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 1 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 2 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 2 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 3 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 4 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 4 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 4 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 4 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 5 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 6 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 6 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 6 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 6 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 7 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 8 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 8 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 8 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 8 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 9 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 9 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 10 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 11 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 11 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 12 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 13 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 13 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 14 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 14 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 15 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 16 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 16 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 17 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 18 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 18 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 19 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 20 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 20 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 21 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 22 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 22 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 22 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 22 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 22 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 22 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 23 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 24 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 24 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 25 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 26 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 26 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 27 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 27 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 28 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 29 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 29 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 30 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 31 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 31 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 32 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 33 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 33 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 34 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 35 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 35 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 35 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 35 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 35 <<<
>>> /etc/sudoers.d/jupyter: syntax error near line 35 <<<
sudo: parse error in /etc/sudoers.d/jupyter near line 1
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

答案1

如果你知道root密码那么你可以这样做

$ su root
# rm /etc/sudoers.d/jupyter

visudo将验证 sudo 文件如果处于编辑模式;你在导出模式下运行它...

相关内容