How to make sudo exit on sudoers syntax errors in version 1.9.5 or later?
Issue
sudo
version 1.8.x exits with an error when it encounters a syntax error while parsing thesudoers
file.- In contrast,
sudo
version 1.9.5 and later prints a warning but continues to operate by ignoring the line with the syntax error. -
The goal is to configure
sudo
1.9.5 and later to exit on asudoers
syntax error, which mimics the stricter behavior of version 1.8.x.### sudo-1.8.29-7.el8 # sudo -l sudo: unable to stat /etc/sudoers.d/801_myrule: No such file or directory sudo: parse error in /etc/sudoers near line 119 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin (exit with error) ### sudo-1.9.5p2-1.el8_9 # sudo -l sudo: unable to stat /etc/sudoers.d/801_myrule: No such file or directory (shows results)
Environment
- Red Hat Enterprise Linux 8, 9 and 10
- sudo 1.9.5p2 or later
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.