visudo fails with an error "sudo: no valid sudoers sources found, quitting"

Solution Verified - Updated -

Issue

  • While executing sudo, below error is observed :
[testuser@localhost ~]$  sudo vi /etc/sudoers
>>> /etc/sudoers.d/testuser: syntax error near line 1 <<<
sudo: parse error in /etc/sudoers.d/testuser near line 1
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

Environment

  • Red Hat Enterprise Linux

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content