I attempted to add myself to the sudoers file a couple of days ago. I didn't want to have to login into root to do anything so I went into the file and inserted my name under root. Now I cannot use the sudo command even when I'm logged into root. Does anyone know how to resolve this issue?

  • 1
    What distribution?
    – jdwolf
    Dec 28 '17 at 21:26
  • I'm using fedora server. I get this message: >>>/etc/sudoers: syntax error near line 99 <<< sudo: parse error in /etc/sudoers near line 99 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin. Dec 28 '17 at 21:33


su root


EDITOR=nano visudo

To fix the file yourself. Or

rm /etc/sudoers

On Debian:

apt-get --reinstall install sudo

On Fedora:

yum reinstall sudo

Then do things the right way:

usermod -aG sudo,wheel [user]


sudo whoami
  • I got this error when I typed in the line after the rm command. bash: apt-get: command not found. Dec 28 '17 at 21:36
  • Use yum reinstall sudo
    – jdwolf
    Dec 28 '17 at 21:37
  • One more question. Do I delete this post now since it got answered? Or do I just leave it? Dec 28 '17 at 21:41
  • @Sidney Upton Thats up to you. Usually you leave it for others.
    – jdwolf
    Dec 28 '17 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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