How to fix /etc/sudoers errors

Error 1

/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

Solution 1A


On your terminal type:

pkexec nano /etc/sudoers

It will open the file and you can edit now. To save and exit the file, just press:


And it will ask you if you wanna save the file. So type: Y and >Enter. Done!!!

Solution 1B

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

Error 2

sudo: error in /etc/sudo.conf, line 0 while loading plugin 'sudoers_policy'
sudo: /usr/lib/sudo/ must only be writable by owner
sudo: fatal error, unable to load plugins
:~$ pkexec su
Error executing command as another user: Not authorized

This incident has been reported

Solution 2

$ su root     #enter password
$ chmod 644 /usr/lib/sudo/
$ chown -R root /usr/lib/sudo

If not, you’ll have to startup in recovery mode, get write permission on your disk, and change the mode of that file. https:// wiki.ubuntu .com/RecoveryMode

$ mount -o remount,rw /
$ chmod 644 /usr/lib/sudo/

If above solutions doesn’t work, reinstall !