[Solved] Ubuntu Server 18.4 System /etc/sudoers: syntax error near line 32

Cause: Because the /etc/sudoers file was previously edited with a problem, the default Ubuntu system could not use sudo to raise power after saving, and could not use root privileges causing a big problem; the default Ubuntu system root was not allowed to log in, and the root login password had not been set before; sadly, it could not be modified by directly logging into the root account.

The problem is in /etc/sudoers: syntax error near line 32 of the sudoers file.

Solution.

1. open two shell windows with the normal user “ubuntu”.

2, in the first ssh session execute “echo $$” and write down the PID

3, in the second ssh session, execute “pkttyagent –process PID”.

4. Execute “pkexec visudo” in the first ssh session and then enter the password in the second ssh session. This will give you access to the /etc/sudoers file, then you will know the error line and modify the data.

5. Use the nano editor for editing by default.

1、Execute "Ctrl+O" #Save
2, after the implementation of "Ctrl + O", the output will be "File Name to Write sudoers.tmp", in tmp after the implementation of the carriage return * 
3、Execute "Ctrl+X "* #Exit

At this time, when you open the shell link, you will not report an error when using sudo and Su rights raising behavior;

Read More: