ubuntu corrupt sudoers file

In the Linux system, to execute the sudo command, you need to configure the /etc/sudoers file accordingly.

 

It is generally recommended to use the visudo command to operate the file. Note: Do not use vi directly. Using vi directly will not perform relevant verification on the newly added file, which may cause the file to not be parsed correctly. Eventually, the sudo command cannot be used, nor can it be A series of problems such as switching to use the root user.

The general error message is as follows:

sudo: parse error in /etc/sudoers near line 24
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

 

If an error occurs, the following solutions are executed:

pkexec visudo

Enter the file editing, directly modify the wrong place just now, save and exit, and return to normal.

The premise of the above method is that you want to install pkexec. If it is not installed, you can use the following method.

1. shift into recovery mode 
2. Select the root account 
3. chmod 666 /dev/null 
   mount -o remount rw / 
4. Use vi to go in and delete the wrong information. Just restart.

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326721459&siteId=291194637