I edited my sudoers file in /etc and after that I can't use sudo anymore. I get this whenever I issue the command:
sudo: >>> /etc/sudoers: syntax error near line 30 <<<
sudo: parse error in /etc/sudoers near line 30
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy pluginHow to solve it?
25 Answers
Had the same problem,
sudo: >>> /etc/sudoers: syntax error near line 25 <<<
sudo: parse error in /etc/sudoers near line 25
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy pluginEasier way to fix it is :
pkexec visudo 5 Boot into recovery mode from the GRUB menu (hold the SHIFT key during boot to reveal this menu), enter the root shell.
First you need write permission to edit sudoers, so run
mount -o remount,rw /Then use
visudoand revert your mistake.visudowill check if the resulting sudoers file conforms to the required syntax.By default
visudousesvias editor, but you can tell it to use your favourite text editor with theEDITORenvironment variable, e. g.:EDITOR=nano visudo
This fixed the same problem for me:
pkexec chmod 440 /etc/sudoers
pkexec chmod 775 /etc/sudoers.d
pkexec chmod 440 /etc/sudoers.d/README Below is the default sudoers file for Ubuntu:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD: ALL
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALLI hope it will help you my friend.
1You could also edit /etc/sudoers with any text editor you like:
EDITOR=gedit visudowould use gedit for it. But you should run it from shell. Otherwise you wouldn't be able to read error-Messages.
0