While installing new sudo instructions we faced an error: "sudo: no valid sudoers sources found, quitting". Here suggest we a fix which worked in our case.
>>> /etc/sudoers: syntax error near line 123 <<<
sudo: parse error in /etc/sudoers near line 123
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
We had a need to allow a regular user to restart a service on CentOS 7, and here is what we added:
user ALL= NOPASSWD: systemctl restart custom.service
into sudoers file. The systemctl binary was added without a full path to it. And it caused the error. So here comes a fix:
We specified a full path to the command and it worked:
user ALL= NOPASSWD: /bin/systemctl restart custom.service
No more errors. I hope it will help you if you face the same issue.