Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 plugin

How to solve it?

share|improve this question
That's why you're supposed to use visudo for editing /etc/sudoers – Sergey Jul 31 '12 at 3:48
related question -> what-are-the-differences-between-sudo-su-visudo-chroot-and-gksu – hhlp Jan 2 '13 at 17:47
up vote 5 down vote accepted

Boot into recovery mode from the GRUB menu (hold the SHIFT key during boot to reveal this menu), enter the root shell.

  1. First you need write permission to edit sudoers, so run

    mount -o remount,rw /
  2. Then use visudo and revert your mistake. visudo will check if the resulting sudoers file conforms to the required syntax.

    By default visudo uses vi as editor, but you can tell it to use your favourite text editor with the EDITOR environment variable, e. g.:

    EDITOR=nano visudo
share|improve this answer
Please include in your answer an advice to use visudo to make any change to the sudoers file. – Eric Carvalho Jul 31 '12 at 1:24
@EricCarvalho thank you friend – Dominic Jul 31 '12 at 17:34
@Cumulus007 thank you friend – Dominic Jul 31 '12 at 17:34

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 plugin

Easier way to fix it is :

pkexec visudo 
share|improve this answer
No joy; The program 'pkexec' is currently not installed. You can install it by typing: sudo apt-get install policykit-1 – Koen. Nov 12 '14 at 22:37
Seems to be installed in 14.04. This fix also works for corrupt overrides in sudoers.d, via pkexec visudo -f /etc/sudoers.d/myOverrides. – Heather Turner Mar 12 '15 at 9:51
it's installed as default in 15.04 too. Worked great for this situation. – Michal Illich Jul 8 '15 at 15:50

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

# 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) ALL

I hope it will help you my friend.

share|improve this answer
thank you friend – Dominic Jul 31 '12 at 17:32
As of Ubuntu 12.04, this is no longer the default (since sudo is now the group that confers administrative abilities, though in upgraded systems admin still exists and serves its usual function). – Eliah Kagan Aug 31 '12 at 22:37

You could also edit /etc/sudoers with any text editor you like:

EDITOR=gedit visudo

would use gedit for it. But you should run it from shell. Otherwise you wouldn't be able to read error-Messages.

share|improve this answer
thank you friend – Dominic Jul 31 '12 at 17:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.