如何修复 /etc/sudoers:行号附近的语法错误

Dco*_*r14 6 sudo nano sudoers ubuntu-18.04

我是 Ubuntu 新手。当在 Visual Studio Code 中编辑任何内容时,我必须输入密码。因此,我尝试更改 sudoers 文件,但之后我无法找到发生了什么,并且还出现如下错误。

我用命令来改变我

sudo nano -w /etc/sudoers
Run Code Online (Sandbox Code Playgroud)

之后我按了ctrl+x

/etc/sudoers: syntax error near line 26 <<<
sudo: parse error in /etc/sudoers near line 26
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Run Code Online (Sandbox Code Playgroud)

谢谢。

She*_*zod 9

编辑:

在您的终端上输入:

pkexec nano /etc/sudoers
Run Code Online (Sandbox Code Playgroud)

它将打开该文件,您现在可以进行编辑。要保存并退出文件,只需按:

Ctrl+X
Run Code Online (Sandbox Code Playgroud)

它会询问您是否要保存文件。所以输入:YEnter。完毕!!!


Dco*_*r14 3

we have to write -
pkexec visudo
And it will open the file and one need to change as previous if any made.
Then type Ctrl+X which will ask to save the file. So type: Y and Enter
Run Code Online (Sandbox Code Playgroud)